modifications to allow cards that transform to Auras to attach to a target.

This commit is contained in:
ArsenalNut
2012-01-12 07:08:39 +00:00
parent 1321f730fa
commit c3b232fe7a
3 changed files with 19 additions and 4 deletions

View File

@@ -6926,6 +6926,12 @@ public class Card extends GameEntity implements Comparable<Card> {
AllZone.getComputerPlayer()))) { AllZone.getComputerPlayer()))) {
return false; return false;
} }
} else if (property.startsWith("controllerWasDealtDamageByThisTurn")) {
if (!(source.dealtDmgToHumanThisTurn && this.getController().isPlayer(AllZone.getHumanPlayer()))
&& !(source.dealtDmgToComputerThisTurn && this.getController().isPlayer(
AllZone.getComputerPlayer()))) {
return false;
}
} else if (property.startsWith("wasDealtDamageThisTurn")) { } else if (property.startsWith("wasDealtDamageThisTurn")) {
if ((this.getReceivedDamageFromThisTurn().keySet()).isEmpty()) { if ((this.getReceivedDamageFromThisTurn().keySet()).isEmpty()) {
return false; return false;

View File

@@ -1115,6 +1115,7 @@ public class AbilityFactoryAttach {
final AbilityFactory af = aura.getAbilityFactory(); final AbilityFactory af = aura.getAbilityFactory();
final Target tgt = aura.getTarget(); final Target tgt = aura.getTarget();
final boolean gainControl = "GainControl".equals(af.getMapParams().get("AILogic"));
if (source.getController().isHuman()) { if (source.getController().isHuman()) {
if (tgt.canTgtPlayer()) { if (tgt.canTgtPlayer()) {
@@ -1130,7 +1131,8 @@ public class AbilityFactoryAttach {
final Object o = GuiUtils.getChoice(source + " - Select a player to attach to.", players.toArray()); final Object o = GuiUtils.getChoice(source + " - Select a player to attach to.", players.toArray());
if (o instanceof Player) { if (o instanceof Player) {
source.enchantEntity((Player) o); AbilityFactoryAttach.handleAura(source, (Player) o, false);
//source.enchantEntity((Player) o);
return true; return true;
} }
} else { } else {
@@ -1139,7 +1141,8 @@ public class AbilityFactoryAttach {
final Object o = GuiUtils.getChoice(source + " - Select a card to attach to.", list.toArray()); final Object o = GuiUtils.getChoice(source + " - Select a card to attach to.", list.toArray());
if (o instanceof Card) { if (o instanceof Card) {
source.enchantEntity((Card) o); AbilityFactoryAttach.handleAura(source, (Card) o, gainControl);
//source.enchantEntity((Card) o);
return true; return true;
} }
} }
@@ -1148,10 +1151,12 @@ public class AbilityFactoryAttach {
else if (AbilityFactoryAttach.attachPreference(af, aura, af.getMapParams(), tgt, true)) { else if (AbilityFactoryAttach.attachPreference(af, aura, af.getMapParams(), tgt, true)) {
final Object o = aura.getTarget().getTargets().get(0); final Object o = aura.getTarget().getTargets().get(0);
if (o instanceof Card) { if (o instanceof Card) {
source.enchantEntity((Card) o); //source.enchantEntity((Card) o);
AbilityFactoryAttach.handleAura(source, (Card) o, gainControl);
return true; return true;
} else if (o instanceof Player) { } else if (o instanceof Player) {
source.enchantEntity((Player) o); //source.enchantEntity((Player) o);
AbilityFactoryAttach.handleAura(source, (Player) o, false);
return true; return true;
} }
} }

View File

@@ -25,6 +25,7 @@ import java.util.Map;
import forge.AllZoneUtil; import forge.AllZoneUtil;
import forge.Card; import forge.Card;
import forge.CardList; import forge.CardList;
import forge.Constant;
import forge.Constant.Zone; import forge.Constant.Zone;
import forge.Player; import forge.Player;
import forge.card.spellability.AbilityActivated; import forge.card.spellability.AbilityActivated;
@@ -252,6 +253,9 @@ public class AbilityFactorySetState {
} else { } else {
tgt.setState(abilityFactory.getMapParams().get("NewState")); tgt.setState(abilityFactory.getMapParams().get("NewState"));
} }
if (tgt.isAura()) {
AbilityFactoryAttach.attachAuraOnIndirectEnterBattlefield(tgt);
}
} }
} }