mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
once canPlayAI is wrapped is has to be hidden from outside callers
This commit is contained in:
@@ -17,7 +17,7 @@ public abstract class SpellAiLogic {
|
|||||||
return canPlayAI(aiPlayer, params, sa);
|
return canPlayAI(aiPlayer, params, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean canPlayAI(final Player aiPlayer, final Map<String, String> params, final SpellAbility sa);
|
protected abstract boolean canPlayAI(final Player aiPlayer, final Map<String, String> params, final SpellAbility sa);
|
||||||
|
|
||||||
public final boolean doTriggerAI(final Player aiPlayer, final Map<String, String> params, final SpellAbility sa, final boolean mandatory){
|
public final boolean doTriggerAI(final Player aiPlayer, final Map<String, String> params, final SpellAbility sa, final boolean mandatory){
|
||||||
if (!ComputerUtil.canPayCost(sa, aiPlayer) && !mandatory) {
|
if (!ComputerUtil.canPayCost(sa, aiPlayer) && !mandatory) {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class AddTurnAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
return doTriggerAINoCost(aiPlayer, params, sa, false);
|
return doTriggerAINoCost(aiPlayer, params, sa, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class AlwaysPlayAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class AnimateAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import forge.game.player.Player;
|
|||||||
public class AnimateAllAi extends SpellAiLogic {
|
public class AnimateAllAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
return false;
|
return false;
|
||||||
} // end animateAllCanPlayAI()
|
} // end animateAllCanPlayAI()
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class AttachAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public final class BondAi extends SpellAiLogic {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
return true;
|
return true;
|
||||||
} // end bondCanPlayAI()
|
} // end bondCanPlayAI()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class CanPlayAsDrawbackAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class CannotPlayAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ChangeZoneAllAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
// Change Zone All, can be any type moving from one zone to another
|
// Change Zone All, can be any type moving from one zone to another
|
||||||
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import forge.util.MyRandom;
|
|||||||
public class CharmAi extends SpellAiLogic {
|
public class CharmAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
|
|
||||||
final int num = Integer.parseInt(params.containsKey("CharmNum") ? params.get("CharmNum") : "1");
|
final int num = Integer.parseInt(params.containsKey("CharmNum") ? params.get("CharmNum") : "1");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class ChooseCardAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Card host = sa.getSourceCard();
|
final Card host = sa.getSourceCard();
|
||||||
|
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class ChooseCardNameAi extends SpellAiLogic {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
|
|
||||||
if (params.containsKey("AILogic")) {
|
if (params.containsKey("AILogic")) {
|
||||||
// Don't tap creatures that may be able to block
|
// Don't tap creatures that may be able to block
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class ChooseColorAi extends SpellAiLogic {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
if (!params.containsKey("AILogic")) {
|
if (!params.containsKey("AILogic")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import forge.game.player.Player;
|
|||||||
|
|
||||||
public class ChooseTypeAi extends SpellAiLogic {
|
public class ChooseTypeAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
if (!params.containsKey("AILogic")) {
|
if (!params.containsKey("AILogic")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ClashAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Player opp = ai.getOpponent();
|
final Player opp = ai.getOpponent();
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import forge.game.player.Player;
|
|||||||
public class CloneAi extends SpellAiLogic {
|
public class CloneAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ControlExchangeAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, final SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, final SpellAbility sa) {
|
||||||
Card object1 = null;
|
Card object1 = null;
|
||||||
Card object2 = null;
|
Card object2 = null;
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ import forge.game.zone.ZoneType;
|
|||||||
*/
|
*/
|
||||||
public class ControlGainAi extends SpellAiLogic {
|
public class ControlGainAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, final SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, final SpellAbility sa) {
|
||||||
boolean hasCreature = false;
|
boolean hasCreature = false;
|
||||||
boolean hasArtifact = false;
|
boolean hasArtifact = false;
|
||||||
boolean hasEnchantment = false;
|
boolean hasEnchantment = false;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class CopyPermanentAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
// Card source = sa.getSourceCard();
|
// Card source = sa.getSourceCard();
|
||||||
// TODO - I'm sure someone can do this AI better
|
// TODO - I'm sure someone can do this AI better
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import forge.util.MyRandom;
|
|||||||
public class CounterAi extends SpellAiLogic {
|
public class CounterAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
boolean toReturn = true;
|
boolean toReturn = true;
|
||||||
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
public class CountersMoveAi extends SpellAiLogic {
|
public class CountersMoveAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on what
|
// based on what
|
||||||
// the expected targets could be
|
// the expected targets could be
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import forge.game.zone.ZoneType;
|
|||||||
public class CountersProliferateAi extends SpellAiLogic {
|
public class CountersProliferateAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
boolean chance = true;
|
boolean chance = true;
|
||||||
|
|
||||||
List<Card> cperms = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
List<Card> cperms = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
public class CountersPutAi extends SpellAiLogic {
|
public class CountersPutAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, final SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, final SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on
|
// based on
|
||||||
// what the expected targets could be
|
// what the expected targets could be
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import forge.game.zone.ZoneType;
|
|||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
public class CountersPutAllAi extends SpellAiLogic {
|
public class CountersPutAllAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on what
|
// based on what
|
||||||
// the expected targets could be
|
// the expected targets could be
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import forge.util.MyRandom;
|
|||||||
public class CountersRemoveAi extends SpellAiLogic {
|
public class CountersRemoveAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on what
|
// based on what
|
||||||
// the expected targets could be
|
// the expected targets could be
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class DamageAllAi extends SpellAiLogic
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on what the expected targets could be
|
// based on what the expected targets could be
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class DamageDealAi extends DamageAiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
|
|
||||||
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class DamageEachAi extends DamageAiBase {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
|
|
||||||
if (tgt != null && sa.canTarget(ai.getOpponent())) {
|
if (tgt != null && sa.canTarget(ai.getOpponent())) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class DamagePreventAi extends SpellAiLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
||||||
boolean chance = false;
|
boolean chance = false;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class DamagePreventAllAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
||||||
boolean chance = false;
|
boolean chance = false;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class DebuffAi extends SpellAiLogic {
|
|||||||
// *************************************************************************
|
// *************************************************************************
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(final Player ai, final java.util.Map<String,String> params, final SpellAbility sa) {
|
protected boolean canPlayAI(final Player ai, final java.util.Map<String,String> params, final SpellAbility sa) {
|
||||||
// if there is no target and host card isn't in play, don't activate
|
// if there is no target and host card isn't in play, don't activate
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
if ((sa.getTarget() == null) && !source.isInPlay()) {
|
if ((sa.getTarget() == null) && !source.isInPlay()) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
public class DebuffAllAi extends SpellAiLogic {
|
public class DebuffAllAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
String valid = "";
|
String valid = "";
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
// final Card source = sa.getSourceCard();
|
// final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class DelayedTriggerAi extends SpellAiLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(forge.game.player.Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(forge.game.player.Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final String svarName = params.get("Execute");
|
final String svarName = params.get("Execute");
|
||||||
final SpellAbility trigsa = tempCreator.getAbility(sa.getAbilityFactory().getHostCard().getSVar(svarName), sa.getAbilityFactory().getHostCard());
|
final SpellAbility trigsa = tempCreator.getAbility(sa.getAbilityFactory().getHostCard().getSVar(svarName), sa.getAbilityFactory().getHostCard());
|
||||||
return trigsa.canPlayAI();
|
return trigsa.canPlayAI();
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class DestroyAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on what the expected targets could be
|
// based on what the expected targets could be
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class DestroyAllAi extends SpellAiLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(final Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(final Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on what the expected targets could be
|
// based on what the expected targets could be
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class DigAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
double chance = .4; // 40 percent chance with instant speed stuff
|
double chance = .4; // 40 percent chance with instant speed stuff
|
||||||
if (AbilityFactory.isSorcerySpeed(sa)) {
|
if (AbilityFactory.isSorcerySpeed(sa)) {
|
||||||
chance = .667; // 66.7% chance for sorcery speed (since it will
|
chance = .667; // 66.7% chance for sorcery speed (since it will
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class DigUntilAi extends SpellAiLogic {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
double chance = .4; // 40 percent chance with instant speed stuff
|
double chance = .4; // 40 percent chance with instant speed stuff
|
||||||
if (AbilityFactory.isSorcerySpeed(sa)) {
|
if (AbilityFactory.isSorcerySpeed(sa)) {
|
||||||
chance = .667; // 66.7% chance for sorcery speed (since it will
|
chance = .667; // 66.7% chance for sorcery speed (since it will
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import forge.util.MyRandom;
|
|||||||
public class DiscardAi extends SpellAiLogic {
|
public class DiscardAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String,String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import forge.util.MyRandom;
|
|||||||
public class DrainManaAi extends SpellAiLogic {
|
public class DrainManaAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI cannot use this properly until he can use SAs during Humans turn
|
// AI cannot use this properly until he can use SAs during Humans turn
|
||||||
|
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class DrawAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
|
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
public class EffectAi extends SpellAiLogic {
|
public class EffectAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final GameState game = Singletons.getModel().getGame();
|
final GameState game = Singletons.getModel().getGame();
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
boolean randomReturn = r.nextFloat() <= .6667;
|
boolean randomReturn = r.nextFloat() <= .6667;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class EndTurnAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class FightAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
Target tgt = sa.getTarget();
|
Target tgt = sa.getTarget();
|
||||||
tgt.resetTargets();
|
tgt.resetTargets();
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class FogAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
// AI should only activate this during Human's Declare Blockers phase
|
// AI should only activate this during Human's Declare Blockers phase
|
||||||
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())) {
|
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import forge.game.player.Player;
|
|||||||
|
|
||||||
public class GameLossAi extends SpellAiLogic {
|
public class GameLossAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Player opp = ai.getOpponent();
|
final Player opp = ai.getOpponent();
|
||||||
if (opp.cantLose()) {
|
if (opp.cantLose()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class GameWinAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
if (ai.cantWin()) {
|
if (ai.cantWin()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class LifeExchangeAi extends SpellAiLogic {
|
|||||||
* forge.card.spellability.SpellAbility)
|
* forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
final int myLife = aiPlayer.getLife();
|
final int myLife = aiPlayer.getLife();
|
||||||
Player opponent = aiPlayer.getOpponent();
|
Player opponent = aiPlayer.getOpponent();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class LifeGainAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
|
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class LifeLoseAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
|
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import forge.util.MyRandom;
|
|||||||
public class LifeSetAi extends SpellAiLogic {
|
public class LifeSetAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
// Ability_Cost abCost = sa.getPayCosts();
|
// Ability_Cost abCost = sa.getPayCosts();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import forge.util.MyRandom;
|
|||||||
public class MillAi extends SpellAiLogic {
|
public class MillAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import forge.game.player.Player;
|
|||||||
public class MustAttackAi extends SpellAiLogic {
|
public class MustAttackAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// disabled for the AI for now. Only for Gideon Jura at this time.
|
// disabled for the AI for now. Only for Gideon Jura at this time.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import forge.game.zone.ZoneType;
|
|||||||
public class MustBlockAi extends SpellAiLogic {
|
public class MustBlockAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// disabled for the AI until he/she can make decisions about who to make
|
// disabled for the AI until he/she can make decisions about who to make
|
||||||
// block
|
// block
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class PhasesAi extends SpellAiLogic
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
// This still needs to be fleshed out
|
// This still needs to be fleshed out
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class PlayAi extends SpellAiLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
||||||
final Card source = sa.getAbilityFactory().getHostCard();
|
final Card source = sa.getAbilityFactory().getHostCard();
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class PoisonAi extends SpellAiLogic {
|
|||||||
* forge.card.spellability.SpellAbility)
|
* forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
// int humanPoison = AllZone.getHumanPlayer().getPoisonCounters();
|
// int humanPoison = AllZone.getHumanPlayer().getPoisonCounters();
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class ProtectAi extends SpellAiLogic {
|
|||||||
} // getProtectCreatures()
|
} // getProtectCreatures()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
||||||
// if there is no target and host card isn't in play, don't activate
|
// if there is no target and host card isn't in play, don't activate
|
||||||
if ((sa.getTarget() == null) && !hostCard.isInPlay()) {
|
if ((sa.getTarget() == null) && !hostCard.isInPlay()) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import forge.game.player.Player;
|
|||||||
public class ProtectAllAi extends SpellAiLogic {
|
public class ProtectAllAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
||||||
// if there is no target and host card isn't in play, don't activate
|
// if there is no target and host card isn't in play, don't activate
|
||||||
if ((sa.getTarget() == null) && !hostCard.isInPlay()) {
|
if ((sa.getTarget() == null) && !hostCard.isInPlay()) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class PumpAi extends PumpAiBase {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Cost cost = sa.getPayCosts();
|
final Cost cost = sa.getPayCosts();
|
||||||
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
|
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
|
||||||
final List<String> keywords = params.containsKey("KW") ? Arrays.asList(params.get("KW").split(" & ")) : new ArrayList<String>();
|
final List<String> keywords = params.containsKey("KW") ? Arrays.asList(params.get("KW").split(" & ")) : new ArrayList<String>();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class PumpAllAi extends PumpAiBase {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(final Player ai, Map<String, String> params, final SpellAbility sa) {
|
protected boolean canPlayAI(final Player ai, Map<String, String> params, final SpellAbility sa) {
|
||||||
String valid = "";
|
String valid = "";
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class RearrangeTopOfLibraryAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class RegenerateAi extends SpellAiLogic {
|
|||||||
// **************************************************************
|
// **************************************************************
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
||||||
boolean chance = false;
|
boolean chance = false;
|
||||||
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import forge.game.zone.ZoneType;
|
|||||||
public class RegenerateAllAi extends SpellAiLogic {
|
public class RegenerateAllAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
final Card hostCard = sa.getAbilityFactory().getHostCard();
|
||||||
boolean chance = false;
|
boolean chance = false;
|
||||||
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
final Cost abCost = sa.getAbilityFactory().getAbCost();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import forge.game.player.Player;
|
|||||||
public class RemoveFromCombatAi extends SpellAiLogic {
|
public class RemoveFromCombatAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// disabled for the AI for now. Only for Gideon Jura at this time.
|
// disabled for the AI for now. Only for Gideon Jura at this time.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import forge.game.player.Player;
|
|||||||
public class RepeatAi extends SpellAiLogic {
|
public class RepeatAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Player opp = ai.getOpponent();
|
final Player opp = ai.getOpponent();
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class RestartGameAi extends SpellAiLogic {
|
|||||||
* forge.card.spellability.SpellAbility)
|
* forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
// The only card that uses this is Karn Liberated
|
// The only card that uses this is Karn Liberated
|
||||||
|
|
||||||
// TODO Add Logic, check if AI is losing game state, or life
|
// TODO Add Logic, check if AI is losing game state, or life
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
public class RevealAi extends RevealAiBase {
|
public class RevealAi extends RevealAiBase {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI cannot use this properly until he can use SAs during Humans turn
|
// AI cannot use this properly until he can use SAs during Humans turn
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class RevealHandAi extends RevealAiBase {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
// AI cannot use this properly until he can use SAs during Humans turn
|
// AI cannot use this properly until he can use SAs during Humans turn
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class SacrificeAi extends SpellAiLogic {
|
|||||||
// **************************************************************
|
// **************************************************************
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
boolean chance = sacrificeTgtAI(ai, params, sa);
|
boolean chance = sacrificeTgtAI(ai, params, sa);
|
||||||
|
|
||||||
// Some additional checks based on what is being sacrificed, and who is
|
// Some additional checks based on what is being sacrificed, and who is
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import forge.util.MyRandom;
|
|||||||
public class SacrificeAllAi extends SpellAiLogic
|
public class SacrificeAllAi extends SpellAiLogic
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// AI needs to be expanded, since this function can be pretty complex
|
// AI needs to be expanded, since this function can be pretty complex
|
||||||
// based on what the expected targets could be
|
// based on what the expected targets could be
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ScryAi extends SpellAiLogic {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// Card source = sa.getSourceCard();
|
// Card source = sa.getSourceCard();
|
||||||
|
|
||||||
double chance = .4; // 40 percent chance of milling with instant speed
|
double chance = .4; // 40 percent chance of milling with instant speed
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import forge.game.player.Player;
|
|||||||
|
|
||||||
public class SetStateAi extends SpellAiLogic {
|
public class SetStateAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class SetStateAllAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, Map<String, String> params, SpellAbility sa) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import forge.game.player.Player;
|
|||||||
|
|
||||||
public class ShuffleAi extends SpellAiLogic {
|
public class ShuffleAi extends SpellAiLogic {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// not really sure when the compy would use this; maybe only after a
|
// not really sure when the compy would use this; maybe only after a
|
||||||
// human
|
// human
|
||||||
// deliberately put a card on top of their library
|
// deliberately put a card on top of their library
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import forge.game.player.Player;
|
|||||||
public class StoreSVarAi extends SpellAiLogic {
|
public class StoreSVarAi extends SpellAiLogic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
//Tree of Redemption
|
//Tree of Redemption
|
||||||
|
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
public class TapAi extends TapAiBase {
|
public class TapAi extends TapAiBase {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class TapAllAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(final Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(final Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
// If tapping all creatures do it either during declare attackers of AIs
|
// If tapping all creatures do it either during declare attackers of AIs
|
||||||
// turn
|
// turn
|
||||||
// or during upkeep/begin combat?
|
// or during upkeep/begin combat?
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class TapOrUntapAi extends TapAiBase {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class TokenAi extends SpellAiLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
final Cost cost = sa.getPayCosts();
|
final Cost cost = sa.getPayCosts();
|
||||||
readParameters(params);
|
readParameters(params);
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class TwoPilesAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Card card = sa.getSourceCard();
|
final Card card = sa.getSourceCard();
|
||||||
ZoneType zone = null;
|
ZoneType zone = null;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class UnattachAllAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class UntapAi extends SpellAiLogic {
|
|||||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player ai, Map<String, String> params, SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
final Cost cost = sa.getPayCosts();
|
final Cost cost = sa.getPayCosts();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class UntapAllAi extends SpellAiLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, java.util.Map<String,String> params, SpellAbility sa) {
|
||||||
// check SubAbilities DoTrigger?
|
// check SubAbilities DoTrigger?
|
||||||
final AbilitySub abSub = sa.getSubAbility();
|
final AbilitySub abSub = sa.getSubAbility();
|
||||||
if (abSub != null) {
|
if (abSub != null) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class ComputerUtilAttack {
|
|||||||
|
|
||||||
this.attackers = new ArrayList<Card>();
|
this.attackers = new ArrayList<Card>();
|
||||||
for(Card c : computerList)
|
for(Card c : computerList)
|
||||||
if (CombatUtil.canAttack(c, human))
|
if (CombatUtil.canAttack(c, (GameEntity)human))
|
||||||
attackers.add(c);
|
attackers.add(c);
|
||||||
|
|
||||||
this.blockers = this.getPossibleBlockers(humanList, this.attackers);
|
this.blockers = this.getPossibleBlockers(humanList, this.attackers);
|
||||||
|
|||||||
Reference in New Issue
Block a user