mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Improved the AI for Rathi Assassin, Stalking Assassin and Ethersworn Adjudicator.
This commit is contained in:
@@ -6451,7 +6451,10 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlay() {
|
public boolean canPlay() {
|
||||||
return AllZone.GameAction.isCardInPlay(card) && !card.isTapped() && !card.hasSickness() && super.canPlay();
|
return AllZone.GameAction.isCardInPlay(card)
|
||||||
|
&& !card.isTapped()
|
||||||
|
&& !card.hasSickness()
|
||||||
|
&& super.canPlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -6461,7 +6464,10 @@ public class CardFactory_Creatures {
|
|||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
//slapshot5 - rule 202.2c tells me this needs to use getColors()
|
//slapshot5 - rule 202.2c tells me this needs to use getColors()
|
||||||
//return c.isTapped() && !CardUtil.getColor(c).equals(Constant.Color.Black);
|
//return c.isTapped() && !CardUtil.getColor(c).equals(Constant.Color.Black);
|
||||||
return c.isTapped() && !CardUtil.getColors(c).contains(Constant.Color.Black);
|
return c.isTapped()
|
||||||
|
&& !CardUtil.getColors(c).contains(Constant.Color.Black)
|
||||||
|
&& CardFactoryUtil.canTarget(card, c)
|
||||||
|
&& !c.getKeyword().contains("Indestructible");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -6477,7 +6483,9 @@ public class CardFactory_Creatures {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
|
|
||||||
if(AllZone.GameAction.isCardInPlay(c) && c.isTapped() && CardFactoryUtil.canTarget(card, c)
|
if(AllZone.GameAction.isCardInPlay(c)
|
||||||
|
&& c.isTapped()
|
||||||
|
&& CardFactoryUtil.canTarget(card, c)
|
||||||
&& !CardUtil.getColors(c).contains(Constant.Color.Black)) {
|
&& !CardUtil.getColors(c).contains(Constant.Color.Black)) {
|
||||||
//&& !CardUtil.getColor(c).equals(Constant.Color.Black)) {
|
//&& !CardUtil.getColor(c).equals(Constant.Color.Black)) {
|
||||||
AllZone.GameAction.destroy(c);
|
AllZone.GameAction.destroy(c);
|
||||||
@@ -6496,9 +6504,12 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
PlayerZone zone = AllZone.getZone(c);
|
PlayerZone zone = AllZone.getZone(c);
|
||||||
return c.isCreature() && zone.is(Constant.Zone.Play) && c.isTapped()
|
return c.isCreature()
|
||||||
&& !CardUtil.getColors(c).contains(Constant.Color.Black);
|
&& zone.is(Constant.Zone.Play)
|
||||||
//&& !CardUtil.getColor(c).equals(Constant.Color.Black);
|
&& CardFactoryUtil.canTarget(card, c)
|
||||||
|
&& c.isTapped()
|
||||||
|
&& !CardUtil.getColors(c).contains(Constant.Color.Black);
|
||||||
|
//&& !CardUtil.getColor(c).equals(Constant.Color.Black);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -6914,17 +6925,19 @@ public class CardFactory_Creatures {
|
|||||||
SpellAbility sa;
|
SpellAbility sa;
|
||||||
for(int i = 0; i < AllZone.Stack.size(); i++) {
|
for(int i = 0; i < AllZone.Stack.size(); i++) {
|
||||||
sa = AllZone.Stack.peek(i);
|
sa = AllZone.Stack.peek(i);
|
||||||
if(sa.getSourceCard().equals(card)) return false;
|
if (sa.getSourceCard().equals(card)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AllZone.GameAction.isCardInPlay(card) && !card.hasSickness() && !card.isTapped() && super.canPlay()) return true;
|
if (AllZone.GameAction.isCardInPlay(card)
|
||||||
|
&& !card.hasSickness()
|
||||||
|
&& !card.isTapped()
|
||||||
|
&& super.canPlay()) return true;
|
||||||
else return false;
|
else return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
if(CardFactoryUtil.AI_doesCreatureAttack(card)) return false;
|
if (CardFactoryUtil.AI_doesCreatureAttack(card)) return false;
|
||||||
|
|
||||||
return CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0
|
return CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0
|
||||||
&& CardFactoryUtil.AI_getHumanEnchantment(card, true).size() != 0;
|
&& CardFactoryUtil.AI_getHumanEnchantment(card, true).size() != 0;
|
||||||
@@ -6933,31 +6946,45 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public void chooseTargetAI() {
|
public void chooseTargetAI() {
|
||||||
CardList creature = CardFactoryUtil.AI_getHumanCreature(card, true);
|
CardList creature = CardFactoryUtil.AI_getHumanCreature(card, true);
|
||||||
if(creature.size() > 0) {
|
creature = creature.filter(new CardListFilter() {
|
||||||
|
public boolean addCard(Card c) {
|
||||||
|
return CardFactoryUtil.canTarget(card, c)
|
||||||
|
&& !c.getKeyword().contains("Indestructible");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (creature.size() > 0) {
|
||||||
Card target = CardFactoryUtil.AI_getBestCreature(creature);
|
Card target = CardFactoryUtil.AI_getBestCreature(creature);
|
||||||
setTargetCard(target);
|
setTargetCard(target);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
CardList enchantment = CardFactoryUtil.AI_getHumanEnchantment(card, true);
|
CardList enchantment = CardFactoryUtil.AI_getHumanEnchantment(card, true);
|
||||||
if(enchantment.size() > 0) {
|
enchantment = enchantment.filter(new CardListFilter() {
|
||||||
|
public boolean addCard(Card c) {
|
||||||
|
return CardFactoryUtil.canTarget(card, c)
|
||||||
|
&& !c.getKeyword().contains("Indestructible");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (enchantment.size() > 0) {
|
||||||
Card target = CardFactoryUtil.AI_getBestEnchantment(enchantment, card, true);
|
Card target = CardFactoryUtil.AI_getBestEnchantment(enchantment, card, true);
|
||||||
setTargetCard(target);
|
setTargetCard(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}//chooseTargetAI()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if(AllZone.GameAction.isCardInPlay(getTargetCard())
|
if (AllZone.GameAction.isCardInPlay(getTargetCard())
|
||||||
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
|
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
|
||||||
AllZone.GameAction.destroy(getTargetCard());
|
AllZone.GameAction.destroy(getTargetCard());
|
||||||
}
|
}
|
||||||
}//resolve()
|
}//resolve()
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
|
|
||||||
card.addSpellAbility(ability);
|
card.addSpellAbility(ability);
|
||||||
ability.setDescription("tap, 1 W B: Destroy target creature or enchantment.");
|
ability.setDescription("tap, 1 W B: Destroy target creature or enchantment.");
|
||||||
|
|
||||||
//ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
|
|
||||||
|
|
||||||
Input runtime = new Input() {
|
Input runtime = new Input() {
|
||||||
private static final long serialVersionUID = -8099713981623158814L;
|
private static final long serialVersionUID = -8099713981623158814L;
|
||||||
|
|
||||||
@@ -6968,17 +6995,18 @@ public class CardFactory_Creatures {
|
|||||||
all.addAll(AllZone.Computer_Play.getCards());
|
all.addAll(AllZone.Computer_Play.getCards());
|
||||||
all = all.filter(new CardListFilter() {
|
all = all.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return (c.isEnchantment() || c.isCreature()) && CardFactoryUtil.canTarget(card, c);
|
return (c.isEnchantment() || c.isCreature())
|
||||||
|
&& CardFactoryUtil.canTarget(card, c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
stopSetNext(CardFactoryUtil.input_targetSpecific(ability, all,
|
stopSetNext(CardFactoryUtil.input_targetSpecific(ability, all,
|
||||||
"Choose target creature or enchantment.", true, false));
|
"Choose target creature or enchantment.", true, false));
|
||||||
}
|
}
|
||||||
};
|
};//Input runtime
|
||||||
|
|
||||||
ability.setBeforePayMana(runtime);
|
ability.setBeforePayMana(runtime);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Wojek Embermage")) {
|
else if(cardName.equals("Wojek Embermage")) {
|
||||||
@@ -10183,43 +10211,47 @@ public class CardFactory_Creatures {
|
|||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Stalking Assassin")) {
|
else if (cardName.equals("Stalking Assassin")) {
|
||||||
|
|
||||||
final Ability_Tap destroy = new Ability_Tap(card, "3 B") {
|
final Ability_Tap destroy = new Ability_Tap(card, "3 B") {
|
||||||
private static final long serialVersionUID = -6612039354743803366L;
|
private static final long serialVersionUID = -6612039354743803366L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
|
CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
|
||||||
human = human.filter(new CardListFilter() {
|
human = human.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return c.isTapped() && CardFactoryUtil.canTarget(card, c);
|
return c.isTapped()
|
||||||
|
&& CardFactoryUtil.canTarget(card, c)
|
||||||
|
&& !c.getKeyword().contains("Indestructible");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (human.size() > 0) {
|
if (human.size() > 0) {
|
||||||
CardListUtil.sortAttack(human);
|
CardListUtil.sortAttack(human);
|
||||||
CardListUtil.sortFlying(human);
|
CardListUtil.sortFlying(human);
|
||||||
setTargetCard(human.get(0));
|
setTargetCard(human.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0 < human.size();
|
return 0 < human.size();
|
||||||
}
|
}//canPlayAI()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
|
|
||||||
if(AllZone.GameAction.isCardInPlay(c) && c.isTapped() && CardFactoryUtil.canTarget(card, c)) {
|
if (AllZone.GameAction.isCardInPlay(c)
|
||||||
|
&& c.isTapped()
|
||||||
|
&& CardFactoryUtil.canTarget(card, c)) {
|
||||||
AllZone.GameAction.destroy(c);
|
AllZone.GameAction.destroy(c);
|
||||||
}
|
}
|
||||||
}//resolve()
|
}//resolve()
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
|
|
||||||
Input target = new Input() {
|
Input target = new Input() {
|
||||||
private static final long serialVersionUID = -8953453455402148585L;
|
private static final long serialVersionUID = -8953453455402148585L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
AllZone.Display.showMessage("Select target tapped creature to destroy");
|
AllZone.Display.showMessage("Select target tapped creature to destroy");
|
||||||
ButtonUtil.enableOnlyCancel();
|
ButtonUtil.enableOnlyCancel();
|
||||||
@@ -10234,7 +10266,9 @@ public class CardFactory_Creatures {
|
|||||||
public void selectCard(Card c, PlayerZone zone) {
|
public void selectCard(Card c, PlayerZone zone) {
|
||||||
if (!CardFactoryUtil.canTarget(card, c)) {
|
if (!CardFactoryUtil.canTarget(card, c)) {
|
||||||
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?).");
|
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?).");
|
||||||
} else if (c.isCreature() && zone.is(Constant.Zone.Play) && c.isTapped()) {
|
} else if (c.isCreature()
|
||||||
|
&& zone.is(Constant.Zone.Play)
|
||||||
|
&& c.isTapped()) {
|
||||||
//tap ability
|
//tap ability
|
||||||
card.tap();
|
card.tap();
|
||||||
|
|
||||||
@@ -10245,10 +10279,10 @@ public class CardFactory_Creatures {
|
|||||||
}//selectCard()
|
}//selectCard()
|
||||||
};//Input
|
};//Input
|
||||||
|
|
||||||
final SpellAbility tap = new Ability_Tap(card, "3 U") {
|
final SpellAbility tap = new Ability_Tap(card, "3 U") {
|
||||||
private static final long serialVersionUID = -8634280576775825017L;
|
private static final long serialVersionUID = -8634280576775825017L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
c.tap();
|
c.tap();
|
||||||
@@ -10256,17 +10290,18 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
|
CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
|
||||||
human = human.filter(new CardListFilter() {
|
human = human.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return c.isUntapped() && CardFactoryUtil.canTarget(card, c);
|
return c.isUntapped()
|
||||||
}
|
&& CardFactoryUtil.canTarget(card, c);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (human.size() > 0) {
|
if (human.size() > 0) {
|
||||||
CardListUtil.sortAttack(human);
|
CardListUtil.sortAttack(human);
|
||||||
CardListUtil.sortFlying(human);
|
CardListUtil.sortFlying(human);
|
||||||
setTargetCard(human.get(0));
|
setTargetCard(human.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
|
||||||
@@ -10274,19 +10309,21 @@ public class CardFactory_Creatures {
|
|||||||
assassins.addAll(play.getCards());
|
assassins.addAll(play.getCards());
|
||||||
|
|
||||||
assassins = assassins.filter(new CardListFilter() {
|
assassins = assassins.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return c.isCreature() && (!c.hasSickness() || c.getKeyword().contains("Haste")) &&
|
return c.isCreature() && (!c.hasSickness() || c.getKeyword().contains("Haste")) &&
|
||||||
c.isUntapped() && !c.equals(card) &&
|
c.isUntapped() && !c.equals(card) &&
|
||||||
(c.getName().equals("Rathi Assassin") || c.getName().equals("Royal Assassin") ||
|
(c.getName().equals("Rathi Assassin") || c.getName().equals("Royal Assassin") ||
|
||||||
c.getName().equals("Tetsuo Umezawa") || c.getName().equals("Stalking Assassin"));
|
c.getName().equals("Tetsuo Umezawa") || c.getName().equals("Stalking Assassin"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Combat attackers = ComputerUtil.getAttackers();
|
Combat attackers = ComputerUtil.getAttackers();
|
||||||
CardList list = new CardList(attackers.getAttackers());
|
CardList list = new CardList(attackers.getAttackers());
|
||||||
|
|
||||||
return (AllZone.Phase.getPhase().equals(Constant.Phase.Main1) && AllZone.Phase.getActivePlayer().equals(card.getController()) &&
|
return (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)
|
||||||
human.size() > 0 && (assassins.size() > 0 || !list.contains(card)));
|
&& AllZone.Phase.getActivePlayer().equals(card.getController())
|
||||||
|
&& human.size() > 0
|
||||||
|
&& (assassins.size() > 0 || !list.contains(card)));
|
||||||
|
|
||||||
}//canPlayAI
|
}//canPlayAI
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
@@ -20212,7 +20249,7 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
|
|
||||||
//*************** START *********** START ************************
|
//*************** START *********** START ************************
|
||||||
if(cardName.equals("Lord of the Undead")) {
|
else if(cardName.equals("Lord of the Undead")) {
|
||||||
final Ability_Tap ability = new Ability_Tap(card, "1 B") {
|
final Ability_Tap ability = new Ability_Tap(card, "1 B") {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4287216165943846367L;
|
private static final long serialVersionUID = -4287216165943846367L;
|
||||||
|
|||||||
Reference in New Issue
Block a user