mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Morph - Fixed that static effects (eg. all your creatures gain vigilance) did not work for morphed creatures. Some more minor fixes to morph ability.
This commit is contained in:
parent
77fdd7711f
commit
a407ec6fd9
3 changed files with 23 additions and 6 deletions
|
@ -142,6 +142,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
|
|||
super(ability);
|
||||
this.alternateCosts.addAll(ability.alternateCosts);
|
||||
this.zoneChangeCounter = ability.zoneChangeCounter;
|
||||
this.ruleText = ability.ruleText;
|
||||
}
|
||||
|
||||
private static Costs createCosts(Cost cost) {
|
||||
|
@ -224,6 +225,11 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule(boolean all) {
|
||||
return getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return ruleText;
|
||||
|
@ -292,8 +298,13 @@ class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implements Sour
|
|||
permanent.getColor().setColor(new ObjectColor());
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
Card card = game.getCard(permanent.getId()); //
|
||||
List<Ability> abilities = new ArrayList<>();
|
||||
for (Ability ability : permanent.getAbilities()) {
|
||||
if (card != null && !card.getAbilities().contains(ability)) {
|
||||
// gained abilities from other sources won't be removed
|
||||
continue;
|
||||
}
|
||||
// TODO: Add flag "works also face down" to ability and use it to control ability removement instead of instanceof check
|
||||
if (ability.getWorksFaceDown()) {
|
||||
ability.setRuleVisible(false);
|
||||
|
|
|
@ -213,7 +213,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
@Override
|
||||
public List<String> getRules() {
|
||||
try {
|
||||
List<String> rules = abilities.getRules(this.name);
|
||||
List<String> rules = abilities.getRules(this.getLogName());
|
||||
if (info != null) {
|
||||
for (String data : info.values()) {
|
||||
rules.add(data);
|
||||
|
|
|
@ -51,6 +51,7 @@ import mage.abilities.keyword.LifelinkAbility;
|
|||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
import mage.abilities.keyword.WitherAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
|
@ -798,18 +799,23 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
@Override
|
||||
public boolean destroy(UUID sourceId, Game game, boolean noRegen) {
|
||||
//20091005 - 701.6
|
||||
//TODO: handle noRegen
|
||||
|
||||
if(abilities.containsKey(IndestructibleAbility.getInstance().getId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) {
|
||||
if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) {
|
||||
if (this.getCardType().contains(CardType.CREATURE)) {
|
||||
game.informPlayers(new StringBuilder(this.getLogName()).append(" died").toString());
|
||||
String logName;
|
||||
Card card = game.getCard(this.getId());
|
||||
if (card != null) {
|
||||
logName = card.getLogName();
|
||||
} else {
|
||||
game.informPlayers(new StringBuilder(this.getLogName()).append(" was destroyed").toString());
|
||||
logName = this.getLogName();
|
||||
}
|
||||
if (this.getCardType().contains(CardType.CREATURE)) {
|
||||
game.informPlayers(logName +" died");
|
||||
} else {
|
||||
game.informPlayers(logName + " was destroyed");
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT, objectId, sourceId, controllerId));
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue