public LevelAbility(int level1, int level2, Abilities<Ability> abilities, int power, int toughness) { this.level1 = level1; this.level2 = level2; this.abilities.addAll(abilities); this.power = power; this.toughness = toughness; }
/** * Gets all current abilities - includes additional abilities added by other * cards or effects * * @param game * @return A list of {@link Ability} - this collection is not modifiable */ @Override public Abilities<Ability> getAbilities(Game game) { Abilities<Ability> otherAbilities = game.getState().getAllOtherAbilities(objectId); if (otherAbilities == null || otherAbilities.isEmpty()) { return abilities; } Abilities<Ability> all = new AbilitiesImpl<>(); all.addAll(abilities); all.addAll(otherAbilities); return all; }
public void addAbility(Ability ability) { if (abilities == null) { abilities = new AbilitiesImpl<>(); } abilities.add(ability); abilities.addAll(ability.getSubAbilities()); }
@Override public Abilities<Ability> getAbilities(Game game) { Abilities<Ability> allAbilites = new AbilitiesImpl<>(); for (Ability ability : super.getAbilities(game)) { if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT_AFTERMATH) { allAbilites.add(ability); } } allAbilites.addAll(leftHalfCard.getAbilities(game)); allAbilites.addAll(rightHalfCard.getAbilities(game)); return allAbilites; }
@Override public Abilities<Ability> getAbilities() { Abilities<Ability> allAbilites = new AbilitiesImpl<>(); for (Ability ability : super.getAbilities()) { if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT_AFTERMATH) { allAbilites.add(ability); } } allAbilites.addAll(leftHalfCard.getAbilities()); allAbilites.addAll(rightHalfCard.getAbilities()); return allAbilites; }
objectAbilities.addAll(((Spell) this).getSpellAbilities()); } else { objectAbilities.add(getStackAbility());
private void copyFromToken(Token token, Game game, boolean reset) { this.name = token.getName(); this.abilities.clear(); if (reset) { this.abilities.addAll(token.getAbilities()); } else { // first time -> create ContinuousEffects only once for (Ability ability : token.getAbilities()) { this.addAbility(ability, game); } } this.abilities.setControllerId(this.controllerId); this.manaCost.clear(); for (ManaCost cost : token.getManaCost()) { this.getManaCost().add(cost.copy()); } this.cardType.clear(); this.cardType.addAll(token.getCardType()); this.color = token.getColor(game).copy(); this.frameColor = token.getFrameColor(game); this.frameStyle = token.getFrameStyle(); this.supertype.clear(); this.supertype.addAll(token.getSuperType()); this.subtype.clear(); this.subtype.addAll(token.getSubtype(game)); this.isAllCreatureTypes = token.isAllCreatureTypes(); this.tokenDescriptor = token.getTokenDescriptor(); }
private void init(Card card, Game game) { power = card.getPower().copy(); toughness = card.getToughness().copy(); copyFromCard(card, game); // if temporary added abilities to the spell/card exist, you need to add it to the permanent derived from that card Abilities<Ability> otherAbilities = game.getState().getAllOtherAbilities(card.getId()); if (otherAbilities != null) { abilities.addAll(otherAbilities); } /*if (card.getCardType().contains(CardType.PLANESWALKER)) { this.loyalty = new MageInt(card.getLoyalty().getValue()); }*/ if (card instanceof LevelerCard) { maxLevelCounters = ((LevelerCard) card).getMaxLevelCounters(); } if (isTransformable()) { if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId()) != null) { game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId(), null); setTransformed(true); TransformAbility.transform(this, getSecondCardFace(), game); } } }