Search in sources :

Example 6 with CreateTokenEvent

use of mage.game.events.CreateTokenEvent in project mage by magefree.

the class AcademyManufactorEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    int amount = 0;
    Map<Token, Integer> tokens = ((CreateTokenEvent) event).getTokens();
    for (Iterator<Map.Entry<Token, Integer>> iter = tokens.entrySet().iterator(); iter.hasNext(); ) {
        Map.Entry<Token, Integer> entry = iter.next();
        Token token = entry.getKey();
        if (token.hasSubtype(SubType.CLUE, game) || token.hasSubtype(SubType.FOOD, game) || token.hasSubtype(SubType.TREASURE, game)) {
            amount += entry.getValue();
            iter.remove();
        }
    }
    tokens.put(new ClueArtifactToken(), amount);
    tokens.put(new FoodToken(), amount);
    tokens.put(new TreasureToken(), amount);
    return false;
}
Also used : ClueArtifactToken(mage.game.permanent.token.ClueArtifactToken) TreasureToken(mage.game.permanent.token.TreasureToken) FoodToken(mage.game.permanent.token.FoodToken) ClueArtifactToken(mage.game.permanent.token.ClueArtifactToken) Token(mage.game.permanent.token.Token) TreasureToken(mage.game.permanent.token.TreasureToken) Map(java.util.Map) CreateTokenEvent(mage.game.events.CreateTokenEvent) FoodToken(mage.game.permanent.token.FoodToken)

Aggregations

CreateTokenEvent (mage.game.events.CreateTokenEvent)6 Token (mage.game.permanent.token.Token)4 Map (java.util.Map)3 TreasureToken (mage.game.permanent.token.TreasureToken)2 Player (mage.players.Player)2 FilterPermanent (mage.filter.FilterPermanent)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 PermanentToken (mage.game.permanent.PermanentToken)1 AngelVigilanceToken (mage.game.permanent.token.AngelVigilanceToken)1 ClueArtifactToken (mage.game.permanent.token.ClueArtifactToken)1 FoodToken (mage.game.permanent.token.FoodToken)1 SquirrelToken (mage.game.permanent.token.SquirrelToken)1 TargetPermanent (mage.target.TargetPermanent)1