More correct checking for having subtypes (card.hasSubtype()). Changeling ability. Refactored all cards.

This commit is contained in:
magenoxx 2011-08-14 10:30:26 +04:00
parent 2da9518486
commit f13ba5d7fb
24 changed files with 126 additions and 21 deletions

View file

@ -100,7 +100,7 @@ class AshenSkinZuberaWatcher extends WatcherImpl<AshenSkinZuberaWatcher> {
if (((ZoneChangeEvent) event).getFromZone() == Constants.Zone.BATTLEFIELD &&
((ZoneChangeEvent) event).getToZone() == Constants.Zone.GRAVEYARD) {
Card card = game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
if (card != null && card.getSubtype().contains("Zubera")) {
if (card != null && card.hasSubtype("Zubera")) {
zuberasDiedThisTurn++;
}
}

View file

@ -99,7 +99,7 @@ class DrippingTongueZuberaWatcher extends WatcherImpl<DrippingTongueZuberaWatche
if (((ZoneChangeEvent) event).getFromZone() == Constants.Zone.BATTLEFIELD &&
((ZoneChangeEvent) event).getToZone() == Constants.Zone.GRAVEYARD) {
Card card = game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
if (card != null && card.getSubtype().contains("Zubera")) {
if (card != null && card.hasSubtype("Zubera")) {
zuberasDiedThisTurn++;
}
}

View file

@ -101,7 +101,7 @@ class EmberFistZuberaWatcher extends WatcherImpl<EmberFistZuberaWatcher> {
if (((ZoneChangeEvent) event).getFromZone() == Constants.Zone.BATTLEFIELD &&
((ZoneChangeEvent) event).getToZone() == Constants.Zone.GRAVEYARD) {
Card card = game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
if (card != null && card.getSubtype().contains("Zubera")) {
if (card != null && card.hasSubtype("Zubera")) {
zuberasDiedThisTurn++;
}
}

View file

@ -98,7 +98,7 @@ class FloatingDreamZuberaWatcher extends WatcherImpl<FloatingDreamZuberaWatcher>
if (((ZoneChangeEvent) event).getFromZone() == Constants.Zone.BATTLEFIELD &&
((ZoneChangeEvent) event).getToZone() == Constants.Zone.GRAVEYARD) {
Card card = game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
if (card != null && card.getSubtype().contains("Zubera")) {
if (card != null && card.hasSubtype("Zubera")) {
zuberasDiedThisTurn++;
}
}

View file

@ -100,7 +100,7 @@ class SeshiroTheAnointedAbility extends TriggeredAbilityImpl<SeshiroTheAnointedA
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
Permanent p = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && p != null && p.getSubtype().contains("Snake")) {
if (damageEvent.isCombatDamage() && p != null && p.hasSubtype("Snake")) {
return true;
}
}

View file

@ -99,7 +99,7 @@ class SilentChantZuberaWatcher extends WatcherImpl<SilentChantZuberaWatcher> {
if (((ZoneChangeEvent) event).getFromZone() == Constants.Zone.BATTLEFIELD &&
((ZoneChangeEvent) event).getToZone() == Constants.Zone.GRAVEYARD) {
Card card = game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
if (card != null && card.getSubtype().contains("Zubera")) {
if (card != null && card.hasSubtype("Zubera")) {
zuberasDiedThisTurn++;
}
}

View file

@ -101,7 +101,7 @@ class StormtideLeviathanEffect extends ContinuousEffectImpl<StormtideLeviathanEf
@Override
public boolean apply(Game game, Ability source) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), game)) {
if (!permanent.getSubtype().contains("Island"))
if (!permanent.hasSubtype("Island"))
permanent.getSubtype().add("Island");
}
return true;

View file

@ -30,7 +30,6 @@ package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.ConditionalMana;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageObject;
@ -40,7 +39,6 @@ import mage.abilities.condition.Condition;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.mana.BasicManaAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
@ -98,7 +96,7 @@ class EldraziManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId());
if (object != null && object.getSubtype().contains("Eldrazi") && !object.getColor().hasColor()) {
if (object != null && object.hasSubtype("Eldrazi") && !object.getColor().hasColor()) {
return true;
}
return false;

View file

@ -113,7 +113,7 @@ class MyrManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId());
if (object != null && object.getSubtype().contains("Myr")) {
if (object != null && object.hasSubtype("Myr")) {
return true;
}
return false;

View file

@ -124,7 +124,7 @@ class PrecursorGolemCopyTriggeredAbility extends TriggeredAbilityImpl<PrecursorG
for (UUID target : effect.getTargetPointer().getTargets(sa)) {
Permanent permanent = game.getPermanent(target);
if (permanent != null) {
if (!permanent.getSubtype().contains("Golem")) {
if (!permanent.hasSubtype("Golem")) {
return false;
}
if (targetGolem == null) {

View file

@ -108,7 +108,7 @@ class ReaperKingAbility extends TriggeredAbilityImpl<ReaperKingAbility> {
Permanent permanent = game.getPermanent(targetId);
if (permanent.getControllerId().equals(this.controllerId)
&& permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getSubtype().contains("Scarecrow")
&& permanent.hasSubtype("Scarecrow")
&& !targetId.equals(this.getSourceId())) {
return true;
}

View file

@ -102,7 +102,7 @@ class JuggernautEffect extends CantBlockSourceEffect {
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
return !blocker.getSubtype().contains("Wall");
return !blocker.hasSubtype("Wall");
}
@Override

View file

@ -115,7 +115,7 @@ class EyeOfUginCostReductionEffect extends CostModificationEffectImpl<EyeOfUginC
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ( abilityToModify instanceof SpellAbility ) {
Card sourceCard = game.getCard(((SpellAbility)abilityToModify).getSourceId());
if ( sourceCard != null && sourceCard.getSubtype().contains("Eldrazi") && sourceCard.getOwnerId().equals(source.getControllerId()) ) {
if ( sourceCard != null && sourceCard.hasSubtype("Eldrazi") && sourceCard.getOwnerId().equals(source.getControllerId()) ) {
return true;
}
}

View file

@ -110,7 +110,7 @@ class KalastriaHighbornTriggeredAbility extends TriggeredAbilityImpl<KalastriaHi
zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
permanent.getControllerId().equals(this.getControllerId()) &&
permanent.getSubtype().contains("Vampire"))
permanent.hasSubtype("Vampire"))
{
return true;
}

View file

@ -121,7 +121,7 @@ class BladeOfTheBloodchiefEffect extends OneShotEffect<BladeOfTheBloodchiefEffec
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) {
if ( creature.getSubtype().contains("Vampire") ) {
if ( creature.hasSubtype("Vampire") ) {
creature.addCounters(new PlusOneCounter(2), game);
}
else {

View file

@ -96,7 +96,7 @@ class ValakutTheMoltenPinnacleTriggeredAbility extends TriggeredAbilityImpl<Vala
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.controllerId)) {
if(permanent.getSubtype().contains("Mountain")){
if(permanent.hasSubtype("Mountain")){
int count = game.getBattlefield().count(ValakutTheMoltenPinnacle.filter, permanent.getControllerId(), game);