mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Merge pull request #3372 from ingmargoudt/changelings
change getSubtype(game).contains(..) to hasSubtype(..) to include che…
This commit is contained in:
commit
d1e4a7f6b0
23 changed files with 28 additions and 34 deletions
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue