mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
CardFactoryUtil & PhaseHandler: make Exalted a real Keyword
This commit is contained in:
@@ -2546,6 +2546,9 @@ public class CardFactoryUtil {
|
||||
card.addTrigger(parsedTriggerOther);
|
||||
card.setSVar("TrigBondSelf", abStringOther);
|
||||
}
|
||||
else if (keyword.equals("Exalted")) {
|
||||
addTriggerAbility(keyword, card, null);
|
||||
}
|
||||
else if (keyword.equals("Extort")) {
|
||||
addTriggerAbility(keyword, card, null);
|
||||
}
|
||||
@@ -2909,7 +2912,20 @@ public class CardFactoryUtil {
|
||||
public static void addTriggerAbility(final String keyword, final Card card, final KeywordsChange kws) {
|
||||
final boolean intrinsic = kws == null;
|
||||
|
||||
if (keyword.equals("Extort")) {
|
||||
if (keyword.equals("Exalted")) {
|
||||
final StringBuilder trigExalted = new StringBuilder(
|
||||
"Mode$ Attacks | ValidCard$ Creature.YouCtrl | Alone$ True | "
|
||||
+ "Execute$ ExaltedPump | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ "
|
||||
+ "Exalted (" + Keyword.getInstance(keyword).getReminderText() + ")");
|
||||
|
||||
final String abStringExalted = "DB$ Pump | Defined$ TriggeredAttacker | NumAtt$ +1 | NumDef$ +1";
|
||||
card.setSVar("ExaltedPump", abStringExalted);
|
||||
final Trigger exaltedTrigger = TriggerHandler.parseTrigger(trigExalted.toString(), card, intrinsic);
|
||||
final Trigger cardTrigger = card.addTrigger(exaltedTrigger);
|
||||
if (!intrinsic) {
|
||||
kws.addTrigger(cardTrigger);
|
||||
}
|
||||
} else if (keyword.equals("Extort")) {
|
||||
final String extortTrigger = "Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | "
|
||||
+ "TriggerZones$ Battlefield | Execute$ ExtortOpps | Secondary$ True"
|
||||
+ " | TriggerDescription$ Extort ("+ Keyword.getInstance(keyword).getReminderText() +")";
|
||||
|
||||
@@ -519,25 +519,6 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
}
|
||||
game.fireEvent(new GameEventAttackersDeclared(playerTurn, attackersMap));
|
||||
|
||||
// This Exalted handler should be converted to script
|
||||
if (combat.getAttackers().size() == 1) {
|
||||
final Player attackingPlayer = combat.getAttackingPlayer();
|
||||
final Card attacker = combat.getAttackers().get(0);
|
||||
for (Card card : attackingPlayer.getCardsIn(ZoneType.Battlefield)) {
|
||||
int exaltedMagnitude = card.getAmountOfKeyword("Exalted");
|
||||
|
||||
for (int i = 0; i < exaltedMagnitude; i++) {
|
||||
String abScript = String.format("AB$ Pump | Cost$ 0 | Defined$ CardUID_%d | NumAtt$ +1 | NumDef$ +1 | StackDescription$ Exalted for attacker {c:CardUID_%d} (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn).", attacker.getId(), attacker.getId());
|
||||
SpellAbility ability = AbilityFactory.getAbility(abScript, card);
|
||||
ability.setActivatingPlayer(card.getController());
|
||||
ability.setDescription(ability.getStackDescription());
|
||||
ability.setTrigger(true);
|
||||
|
||||
game.getStack().addSimultaneousStackEntry(ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fire AttackersDeclared trigger
|
||||
if (!combat.getAttackers().isEmpty()) {
|
||||
List<GameEntity> attackedTarget = new ArrayList<GameEntity>();
|
||||
|
||||
Reference in New Issue
Block a user