forked from External/mage
More correct checking for having subtypes (card.hasSubtype()). Changeling ability. Refactored all cards.
This commit is contained in:
parent
2da9518486
commit
f13ba5d7fb
24 changed files with 126 additions and 21 deletions
|
|
@ -39,6 +39,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.keyword.ChangelingAbility;
|
||||
import mage.game.Game;
|
||||
|
||||
public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements MageObject {
|
||||
|
|
@ -150,4 +151,25 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements Mag
|
|||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {}
|
||||
|
||||
@Override
|
||||
public boolean hasSubtype(String subtype) {
|
||||
if (subtype == null) {
|
||||
return false;
|
||||
}
|
||||
if (subtype.contains(subtype)) {
|
||||
return true;
|
||||
}
|
||||
else { // checking for Changeling
|
||||
// first make sure input parameter is not creature type
|
||||
// if so, then ChangelingAbility doesn't matter
|
||||
if (subtype.equals("Mountain") || subtype.equals("Island") || subtype.equals("Plains")
|
||||
|| subtype.equals("Forest") || subtype.equals("Swamp") || subtype.equals("Aura")
|
||||
|| subtype.equals("Equipment") || subtype.equals("Fortification")) {
|
||||
return false;
|
||||
}
|
||||
// as it is creature subtype, then check the existence of Changeling
|
||||
return abilities.contains(ChangelingAbility.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue