mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Fixed ordering of AI spellability priorities.
This commit is contained in:
@@ -340,7 +340,7 @@ public class AiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<SpellAbility> getOriginalAndAltCostAbilities(final List<SpellAbility> originList)
|
private ArrayList<SpellAbility> getOriginalAndAltCostAbilities(final ArrayList<SpellAbility> originList)
|
||||||
{
|
{
|
||||||
final ArrayList<SpellAbility> newAbilities = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> newAbilities = new ArrayList<SpellAbility>();
|
||||||
for (SpellAbility sa : originList) {
|
for (SpellAbility sa : originList) {
|
||||||
@@ -350,7 +350,7 @@ public class AiController {
|
|||||||
newAbilities.addAll(GameActionUtil.getAlternativeCosts(sa));
|
newAbilities.addAll(GameActionUtil.getAlternativeCosts(sa));
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<SpellAbility> result = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> result = new ArrayList<SpellAbility>();
|
||||||
for (SpellAbility sa : newAbilities) {
|
for (SpellAbility sa : newAbilities) {
|
||||||
sa.setActivatingPlayer(player);
|
sa.setActivatingPlayer(player);
|
||||||
result.addAll(GameActionUtil.getOptionalCosts(sa));
|
result.addAll(GameActionUtil.getOptionalCosts(sa));
|
||||||
@@ -588,7 +588,7 @@ public class AiController {
|
|||||||
* a {@link java.util.ArrayList} object.
|
* a {@link java.util.ArrayList} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
private SpellAbility chooseCounterSpell(final List<SpellAbility> possibleCounters) {
|
private SpellAbility chooseCounterSpell(final ArrayList<SpellAbility> possibleCounters) {
|
||||||
if ( possibleCounters == null || possibleCounters.isEmpty())
|
if ( possibleCounters == null || possibleCounters.isEmpty())
|
||||||
return null;;
|
return null;;
|
||||||
|
|
||||||
@@ -761,9 +761,9 @@ public class AiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cast 0 mana cost spells first (might be a Mox)
|
// cast 0 mana cost spells first (might be a Mox)
|
||||||
if (a1 == 0) {
|
if (a1 == 0 && b1 > 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (b1 == 0) {
|
} else if (a1 > 0 && b1 == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1132,7 +1132,7 @@ public class AiController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpellAbility chooseSpellAbilyToPlay(final List<SpellAbility> all, boolean skipCounter) {
|
private SpellAbility chooseSpellAbilyToPlay(final ArrayList<SpellAbility> all, boolean skipCounter) {
|
||||||
if ( all == null || all.isEmpty() )
|
if ( all == null || all.isEmpty() )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import forge.game.spellability.TargetRestrictions;
|
|||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* AbilityFactory_Token class.
|
* AbilityFactory_Token class.
|
||||||
@@ -85,7 +83,7 @@ public class TokenAi extends SpellAbilityAi {
|
|||||||
for (final String type : this.tokenTypes) {
|
for (final String type : this.tokenTypes) {
|
||||||
if (type.equals("Legendary")) {
|
if (type.equals("Legendary")) {
|
||||||
// Don't kill AIs Legendary tokens
|
// Don't kill AIs Legendary tokens
|
||||||
if (ai.getCardsIn(ZoneType.Battlefield, this.tokenName).size() > 0) {
|
if (!ai.getCardsIn(ZoneType.Battlefield, this.tokenName).isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,8 +124,6 @@ public class TokenAi extends SpellAbilityAi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent run-away activations - first time will always return true
|
|
||||||
final Random r = MyRandom.getRandom();
|
|
||||||
final Card source = sa.getHostCard();
|
final Card source = sa.getHostCard();
|
||||||
|
|
||||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||||
@@ -181,7 +177,6 @@ public class TokenAi extends SpellAbilityAi {
|
|||||||
if (SpellAbilityAi.playReusable(ai, sa)) {
|
if (SpellAbilityAi.playReusable(ai, sa)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
|
if (game.getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -189,7 +184,7 @@ public class TokenAi extends SpellAbilityAi {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (r.nextFloat() < .8);
|
return MyRandom.getRandom().nextFloat() < .8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Name:Grave Pact
|
Name:Grave Pact
|
||||||
ManaCost:1 B B B
|
ManaCost:1 B B B
|
||||||
Types:Enchantment
|
Types:Enchantment
|
||||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.YouCtrl | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ Whenever a creature you control is put into a graveyard from the battlefield, each other player sacrifices a creature.
|
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.YouCtrl | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ Whenever a creature you control dies, each other player sacrifices a creature.
|
||||||
SVar:TrigSac:AB$ Sacrifice | Cost$ 0 | Defined$ Player.Other | SacValid$ Creature
|
SVar:TrigSac:AB$ Sacrifice | Cost$ 0 | Defined$ Player.Other | SacValid$ Creature
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/grave_pact.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/grave_pact.jpg
|
||||||
Oracle:Whenever a creature you control dies, each other player sacrifices a creature.
|
Oracle:Whenever a creature you control dies, each other player sacrifices a creature.
|
||||||
Reference in New Issue
Block a user