mirror of
https://github.com/Relintai/mtg-forge-ios.git
synced 2024-11-14 04:17:19 +01:00
- Turned CheckCondition into a generic top-level AILogic, used it for both Repeating Barrage and Sasaya, Orochi Ascendant at the same time.
git-svn-id: http://svn.slightlymagic.net/forge/trunk@35800 269b9781-a132-4a9b-9d4e-f004f1b56b58
This commit is contained in:
parent
83b87d4eaf
commit
86b62623e3
@ -1,12 +1,7 @@
|
|||||||
package forge.ai;
|
package forge.ai;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import forge.card.ICardFace;
|
import forge.card.ICardFace;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.card.mana.ManaCostParser;
|
import forge.card.mana.ManaCostParser;
|
||||||
@ -25,6 +20,10 @@ import forge.game.spellability.SpellAbility;
|
|||||||
import forge.game.spellability.SpellAbilityCondition;
|
import forge.game.spellability.SpellAbilityCondition;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for API-specific AI logic
|
* Base class for API-specific AI logic
|
||||||
* <p>
|
* <p>
|
||||||
@ -103,6 +102,12 @@ public abstract class SpellAbilityAi {
|
|||||||
* Checks if the AI will play a SpellAbility with the specified AiLogic
|
* Checks if the AI will play a SpellAbility with the specified AiLogic
|
||||||
*/
|
*/
|
||||||
protected boolean checkAiLogic(final Player ai, final SpellAbility sa, final String aiLogic) {
|
protected boolean checkAiLogic(final Player ai, final SpellAbility sa, final String aiLogic) {
|
||||||
|
if (aiLogic.equals("CheckCondition")) {
|
||||||
|
SpellAbility saCopy = sa.copy();
|
||||||
|
saCopy.setActivatingPlayer(ai);
|
||||||
|
return saCopy.getConditions().areMet(saCopy);
|
||||||
|
}
|
||||||
|
|
||||||
return !("Never".equals(aiLogic));
|
return !("Never".equals(aiLogic));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +70,6 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (aiLogic.equals("RaidOnly")) {
|
|
||||||
return ai.getAttackedWithCreatureThisTurn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.checkAiLogic(ai, sa, aiLogic);
|
return super.checkAiLogic(ai, sa, aiLogic);
|
||||||
|
@ -67,12 +67,6 @@ public class SetStateAi extends SpellAbilityAi {
|
|||||||
protected boolean checkAiLogic(final Player aiPlayer, final SpellAbility sa, final String aiLogic) {
|
protected boolean checkAiLogic(final Player aiPlayer, final SpellAbility sa, final String aiLogic) {
|
||||||
final Card source = sa.getHostCard();
|
final Card source = sa.getHostCard();
|
||||||
|
|
||||||
if (aiLogic.equals("CheckCondition")) {
|
|
||||||
SpellAbility saCopy = sa.copy();
|
|
||||||
saCopy.setActivatingPlayer(aiPlayer);
|
|
||||||
return saCopy.getConditions().areMet(saCopy);
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.checkAiLogic(aiPlayer, sa, aiLogic);
|
return super.checkAiLogic(aiPlayer, sa, aiLogic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ Name:Repeating Barrage
|
|||||||
ManaCost:1 R R
|
ManaCost:1 R R
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
A:SP$ DealDamage | Cost$ 1 R R | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 3 | SpellDescription$ CARDNAME deals 3 damage to target creature or player.
|
A:SP$ DealDamage | Cost$ 1 R R | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 3 | SpellDescription$ CARDNAME deals 3 damage to target creature or player.
|
||||||
A:AB$ ChangeZone | Cost$ 3 R R | PrecostDesc$ Raid — | Origin$ Graveyard | Destination$ Hand | ActivationZone$ Graveyard | CheckSVar$ RaidTest | References$ RaidTest | AILogic$ RaidOnly | SpellDescription$ Return CARDNAME from your graveyard to your hand. Activate this ability only if you attacked with a creature this turn.
|
A:AB$ ChangeZone | Cost$ 3 R R | PrecostDesc$ Raid — | Origin$ Graveyard | Destination$ Hand | ActivationZone$ Graveyard | CheckSVar$ RaidTest | References$ RaidTest | AILogic$ CheckCondition | SpellDescription$ Return CARDNAME from your graveyard to your hand. Activate this ability only if you attacked with a creature this turn.
|
||||||
SVar:RaidTest:Count$AttackersDeclared
|
SVar:RaidTest:Count$AttackersDeclared
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/repeating_barrage.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/repeating_barrage.jpg
|
||||||
Oracle:Repeating Barrage deals 3 damage to target creature or player.\nRaid — {3}{R}{R}: Return Repeating Barrage from your graveyard to your hand. Activate this ability only if you attacked with a creature this turn.
|
Oracle:Repeating Barrage deals 3 damage to target creature or player.\nRaid — {3}{R}{R}: Return Repeating Barrage from your graveyard to your hand. Activate this ability only if you attacked with a creature this turn.
|
||||||
|
Loading…
Reference in New Issue
Block a user