Changed "getSubtype().contains" to "hasSubtype" where creature types are concerned to support Changeling keyword.

This commit is contained in:
LevelX2 2013-01-12 15:23:38 +01:00
parent 6b9a35e0c4
commit 5662fd1145
13 changed files with 14 additions and 13 deletions

View file

@ -158,7 +158,7 @@ class CavernOfSoulsManaCondition extends CreatureCastManaCondition {
Object value = game.getState().getValue(manaProducer + "_type");
if (value != null && value instanceof String) {
MageObject object = game.getObject(source.getSourceId());
if (object.getSubtype().contains(value)) {
if (object.hasSubtype((String) value)) {
return true;
}
}

View file

@ -109,7 +109,7 @@ class HeraldOfWarCostReductionEffect extends CostModificationEffectImpl<HeraldOf
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
Card sourceCard = game.getCard(((SpellAbility) abilityToModify).getSourceId());
if (sourceCard != null && abilityToModify.getControllerId().equals(source.getControllerId()) && (sourceCard.getSubtype().contains("Angel") || sourceCard.getSubtype().contains("Human"))) {
if (sourceCard != null && abilityToModify.getControllerId().equals(source.getControllerId()) && (sourceCard.hasSubtype("Angel") || sourceCard.hasSubtype("Human"))) {
return true;
}
}

View file

@ -114,7 +114,7 @@ class HuntedGhoulEffect extends RestrictionEffect<HuntedGhoulEffect> {
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (attacker != null && attacker.getSubtype().contains("Human")) {
if (attacker != null && attacker.hasSubtype("Human")) {
return false;
}
return true;

View file

@ -100,7 +100,7 @@ public class KentaroTheSmilingCat extends CardImpl<KentaroTheSmilingCat> {
SpellAbility spell = (SpellAbility) abilityToModify;
if (spell.getControllerId().equals(source.getControllerId())) {
Card sourceCard = game.getCard(spell.getSourceId());
if (sourceCard != null && sourceCard.getSubtype().contains("Samurai")) {
if (sourceCard != null && sourceCard.hasSubtype("Samurai")) {
String manaCostsString = "{" + sourceCard.getManaCost().convertedManaCost() + "}";
Player player = game.getPlayer(spell.getControllerId());
if (player != null && player.chooseUse(Constants.Outcome.Benefit, "Pay converted mana cost rather than pay the mana cost for Samurai creature?", game)) {

View file

@ -89,7 +89,7 @@ public class UncheckedGrowth extends CardImpl<UncheckedGrowth> {
int affectedTargets = 0;
for (UUID permanentId : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null && permanent.getSubtype().contains("Spirit")) {
if (permanent != null && permanent.hasSubtype("Spirit")) {
permanent.addAbility(TrampleAbility.getInstance(), game);
affectedTargets++;
}

View file

@ -110,7 +110,7 @@ class SosukeSonOfSeshiroTriggeredAbility extends TriggeredAbilityImpl<SosukeSonO
Permanent sourceCreature = game.getPermanent(event.getSourceId());
Permanent targetCreature = game.getPermanent(event.getTargetId());
if (sourceCreature != null && sourceCreature.getControllerId().equals(this.getControllerId())
&& targetCreature != null && sourceCreature.getSubtype().contains("Warrior")) {
&& targetCreature != null && sourceCreature.hasSubtype("Warrior")) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId()));
return true;
}

View file

@ -98,8 +98,9 @@ class SeanceEffect extends OneShotEffect<SeanceEffect> {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card);
if (!token.getSubtype().contains("Spirit"))
if (!token.hasSubtype("Spirit")) {
token.getSubtype().add("Spirit");
}
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
ExileTargetEffect exileEffect = new ExileTargetEffect();

View file

@ -96,7 +96,7 @@ class RooftopStormCostReductionEffect extends CostModificationEffectImpl<Rooftop
SpellAbility spell = (SpellAbility) abilityToModify;
if (spell.getControllerId().equals(source.getControllerId())) {
Card sourceCard = game.getCard(spell.getSourceId());
if (sourceCard != null && sourceCard.getSubtype().contains("Zombie")) {
if (sourceCard != null && sourceCard.hasSubtype("Zombie")) {
Player player = game.getPlayer(spell.getControllerId());
if (player != null && player.chooseUse(Outcome.Benefit, "Pay {0} rather than pay the mana cost for Zombie creature", game)) {
spell.getManaCostsToPay().clear();

View file

@ -154,7 +154,7 @@ class UndeadAlchemistEffect extends ReplacementEffectImpl<UndeadAlchemistEffect>
DamagePlayerEvent damageEvent = (DamagePlayerEvent) event;
if (damageEvent.isCombatDamage()) {
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null && permanent.getSubtype().contains("Zombie"))
if (permanent != null && permanent.hasSubtype("Zombie"))
return true;
}
}

View file

@ -99,7 +99,7 @@ class AgadeemOccultistEffect extends OneShotEffect<AgadeemOccultistEffect> {
Player you = game.getPlayer(source.getControllerId());
int allycount = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent.getSubtype().contains("Ally")) {
if (permanent.hasSubtype("Ally")) {
allycount++;
}
}

View file

@ -102,7 +102,7 @@ class QuestForTheGoblinLordTriggeredAbility extends TriggeredAbilityImpl<QuestFo
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getSubtype().contains("Goblin") && permanent.getControllerId().equals(super.getControllerId())) {
if (permanent != null && permanent.hasSubtype("Goblin") && permanent.getControllerId().equals(super.getControllerId())) {
return true;
}
}

View file

@ -107,7 +107,7 @@ class TalusPaladinTriggeredAbility extends TriggeredAbilityImpl<TalusPaladinTrig
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
Permanent ally = game.getPermanent(event.getTargetId());
if (ally != null) {
if (ally.getSubtype().contains("Ally")
if (ally.hasSubtype("Ally")
&& ally.getControllerId().equals(this.getControllerId())) {
if (event.getTargetId().equals(this.getSourceId())
|| event.getTargetId().equals(ally.getId())) {

View file

@ -104,7 +104,7 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl<TuktukScrapper
return true;
}
if (permanent != null
&& permanent.getSubtype().contains("Ally")
&& permanent.hasSubtype("Ally")
&& permanent.getControllerId().equals(this.getControllerId())) {
return true;
}