Merge pull request #3372 from ingmargoudt/changelings

change getSubtype(game).contains(..) to hasSubtype(..) to include che…
This commit is contained in:
LevelX2 2017-05-14 06:32:48 +02:00 committed by GitHub
commit d1e4a7f6b0
23 changed files with 28 additions and 34 deletions

View file

@ -96,7 +96,7 @@ class AetherChargeTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.isCreature() && permanent.getSubtype(game).contains("Beast")
if (permanent.isCreature() && permanent.hasSubtype("Beast", game)
&& permanent.getControllerId().equals(this.controllerId)) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());

View file

@ -113,8 +113,8 @@ class BoldwyrIntimidatorEffect extends RestrictionEffect {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (attacker != null && blocker != null) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && attacker.getSubtype(game).contains("Warrior")) {
return !blocker.getSubtype(game).contains("Coward");
if (sourcePermanent != null && attacker.hasSubtype("Warrior", game)) {
return !blocker.hasSubtype("Coward", game);
}
}
return true;

View file

@ -119,7 +119,7 @@ class CaptivatingVampireEffect extends ContinuousEffectImpl {
break;
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!permanent.getSubtype(game).contains("Vampire")) {
if (!permanent.hasSubtype("Vampire", game)) {
permanent.getSubtype(game).add("Vampire");
}
}

View file

@ -89,7 +89,7 @@ class CemeteryRecruitmentEffect extends OneShotEffect {
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
if (controller.moveCards(card, Zone.HAND, source, game)
&& card.getSubtype(game).contains("Zombie")) {
&& card.hasSubtype("Zombie", game)) {
controller.drawCards(1, game);
}
}

View file

@ -91,7 +91,7 @@ class DeathcultRogueRestrictionEffect extends RestrictionEffect {
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (blocker.getSubtype(game).contains("Rogue")) {
if (blocker.hasSubtype("Rogue", game)) {
return true;
}
return false;

View file

@ -101,7 +101,7 @@ class DismissIntoDreamEffect extends ContinuousEffectImpl {
object.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), source.getSourceId(), game);
break;
case TypeChangingEffects_4:
if (!object.getSubtype(game).contains("Illusion")) {
if (!object.hasSubtype("Illusion", game)) {
object.getSubtype(game).add("Illusion");
}
break;

View file

@ -79,7 +79,7 @@ class DralnusCrusadeEffect extends ContinuousEffectImpl {
for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, source.getControllerId(), source.getSourceId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
if (!permanent.getSubtype(game).contains("Zombie")) {
if (!permanent.hasSubtype("Zombie", game)) {
permanent.getSubtype(game).add("Zombie");
}
break;

View file

@ -124,7 +124,7 @@ class EssenceFluxEffect extends OneShotEffect {
controller.moveCards(cardsToBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null);
for (UUID cardId : cardsToBattlefield) {
Permanent permanent = game.getPermanent(cardId);
if (permanent != null && permanent.getSubtype(game).contains("Spirit")) {
if (permanent != null && permanent.hasSubtype("Spirit", game)) {
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
effect.setTargetPointer(new FixedTarget(permanent, game));
return effect.apply(game, source);

View file

@ -168,7 +168,7 @@ class GisaAndGeralfWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) {
Spell spell = (Spell) game.getObject(event.getTargetId());
if (spell.isCreature() && spell.getSubtype(game).contains("Zombie")) {
if (spell.isCreature() && spell.hasSubtype("Zombie", game)) {
abilityUsed = true;
}
}

View file

@ -140,7 +140,7 @@ class DragonCreatureCardPredicate implements Predicate<Card> {
@Override
public boolean apply(Card input, Game game) {
return input.isCreature()
&& input.getSubtype(game).contains("Dragon");
&& input.hasSubtype("Dragon", game);
}
@Override

View file

@ -99,16 +99,12 @@ class LifeAndLimbEffect extends ContinuousEffectImpl {
for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
if (!permanent.isCreature()) {
permanent.addCardType(CardType.CREATURE);
}
if (!permanent.getSubtype(game).contains("Saproling")) {
if (!permanent.hasSubtype("Saproling", game)) {
permanent.getSubtype(game).add("Saproling");
}
if (!permanent.isLand()) {
permanent.addCardType(CardType.LAND);
}
if (!permanent.getSubtype(game).contains("Forest")) {
if (!permanent.hasSubtype("Forest", game)) {
permanent.getSubtype(game).add("Forest");
}
break;

View file

@ -117,7 +117,7 @@ class MephidrossVampireEffect extends ContinuousEffectImpl {
creature.addAbility(new DealsDamageToACreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, false, false), source.getSourceId(), game);
break;
case TypeChangingEffects_4:
if (!creature.getSubtype(game).contains("Vampire")) {
if (!creature.hasSubtype("Vampire", game)) {
creature.getSubtype(game).add("Vampire");
}
break;

View file

@ -97,7 +97,7 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl {
if (card == null) {
return false;
}
isZombieCard = card.getSubtype(game).contains("Zombie");
isZombieCard = card.hasSubtype("Zombie", game);
paid |= player.discard(card, null, game);
}

View file

@ -145,10 +145,8 @@ class NissaSageAnimistMinusSevenEffect extends ContinuousEffectImpl {
if (permanent != null) {
switch (layer) {
case TypeChangingEffects_4:
if (!permanent.isCreature()) {
permanent.addCardType(CardType.CREATURE);
}
if (!permanent.getSubtype(game).contains("Elemental")) {
if (!permanent.hasSubtype("Elemental", game)) {
permanent.getSubtype(game).add("Elemental");
}
break;

View file

@ -55,7 +55,7 @@ public class PhantasmalImage extends CardImpl {
ApplyToPermanent phantasmalImageApplier = new ApplyToPermanent() {
@Override
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
if (!permanent.getSubtype(game).contains("Illusion")) {
if (!permanent.hasSubtype("Illusion", game)) {
permanent.getSubtype(game).add("Illusion");
}
// Add directly because the created permanent is only used to copy from, so there is no need to add the ability to e.g. TriggeredAbilities
@ -66,7 +66,7 @@ public class PhantasmalImage extends CardImpl {
@Override
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
if (!mageObject.getSubtype(game).contains("Illusion")) {
if (!mageObject.hasSubtype("Illusion", game)) {
mageObject.getSubtype(game).add("Illusion");
}
// Add directly because the created permanent is only used to copy from, so there is no need to add the ability to e.g. TriggeredAbilities

View file

@ -102,7 +102,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.getControllerId().equals(source.getControllerId())
&& creature.isCreature()
&& creature.getSubtype(game).contains("Wizard")
&& creature.hasSubtype("Wizard", game)
&& !event.getTargetId().equals(source.getSourceId());
}

View file

@ -99,7 +99,7 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(this.controllerId) && (permanent.getSubtype(game).contains("Wolf") || permanent.getSubtype(game).contains("Werewolf"))) {
if (permanent != null && permanent.getControllerId().equals(this.controllerId) && (permanent.hasSubtype("Wolf", game) || permanent.hasSubtype("Werewolf", game))) {
MageObject object = game.getObject(event.getSourceId());
if (object != null && object instanceof Spell) {
Card c = (Spell) object;

View file

@ -141,7 +141,7 @@ class SirensCallDestroyEffect extends OneShotEffect {
}
// Walls are safe.
if (permanent.getSubtype(game).contains("Wall")) {
if (permanent.hasSubtype("Wall", game)) {
continue;
}
// Creatures that attacked are safe.

View file

@ -118,10 +118,10 @@ class BlockedOrWasBlockedByAZombieWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) {
if (game.getPermanent(event.getTargetId()).getSubtype(game).contains("Zombie")) {
if (game.getPermanent(event.getTargetId()).hasSubtype("Zombie", game)) {
this.blockedOrWasBlockedByAZombieWatcher.add(new MageObjectReference(event.getSourceId(), game));
}
if (game.getPermanent(event.getSourceId()).getSubtype(game).contains("Zombie")) {
if (game.getPermanent(event.getSourceId()).hasSubtype( "Zombie", game)) {
this.blockedOrWasBlockedByAZombieWatcher.add(new MageObjectReference(event.getTargetId(), game));
}
}

View file

@ -112,13 +112,13 @@ class VenomTriggeredAbility extends TriggeredAbilityImpl {
Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());
if (enchantedCreature != null) {
if (blocker != null && !Objects.equals(blocker, enchantedCreature)
&& !blocker.getSubtype(game).contains("Wall")
&& !blocker.hasSubtype("Wall", game)
&& Objects.equals(blocked, enchantedCreature)) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId()));
return true;
}
if (blocker != null && Objects.equals(blocker, enchantedCreature)
&& !blocked.getSubtype(game).contains("Wall")) {
&& !blocked.hasSubtype("Wall", game)) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId()));
return true;
}

View file

@ -102,7 +102,7 @@ class VizierOfManyFacesApplyToPermanent extends ApplyToPermanent {
for (MageObjectReference mor : watcher.getEmbalmedThisTurnCards()) {
if (mor.getSourceId().equals(originalCardId) && game.getState().getZoneChangeCounter(originalCardId) == mor.getZoneChangeCounter()) {
permanent.getManaCost().clear();
if (!permanent.getSubtype(game).contains("Zombie")) {
if (!permanent.hasSubtype("Zombie", game)) {
permanent.getSubtype(game).add("Zombie");
}
permanent.getColor(game).setColor(ObjectColor.WHITE);

View file

@ -96,7 +96,7 @@ class WarrenPilferersReturnEffect extends OneShotEffect {
Card card = game.getCard(source.getFirstTarget());
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
if (card.getSubtype(game).contains("Goblin")) {
if (card.hasSubtype("Goblin", game)) {
game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source);
}
return true;

View file

@ -66,7 +66,7 @@ public class BecomesBlackZombieAdditionEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!creature.getSubtype(game).contains("Zombie")) {
if (!creature.hasSubtype("Zombie", game)) {
creature.getSubtype(game).add("Zombie");
}
}