- The AI will now play auras more often.

- Improved the AI of AF Pump with Defined parameter.
This commit is contained in:
Sloth
2012-02-14 13:51:41 +00:00
parent c3844c5538
commit 8dff34ec7f
3 changed files with 31 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ Text:no text
K:Enchant creature
A:SP$ Attach | Cost$ W | ValidTgts$ Creature | AILogic$ Curse
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ HIDDEN CARDNAME can't block. & HIDDEN CARDNAME's activated abilities can't be activated. | Description$ Enchanted creature can't block and its activated abilities can't be activated.
A:AB$ Pump | Cost$ S | Defined$ Enchanted | KW$ Defender | SpellDescription$ Enchanted creature gains defender until end of turn.
A:AB$ Pump | Cost$ S | Defined$ Enchanted | KW$ Defender | IsCurse$ True | SpellDescription$ Enchanted creature gains defender until end of turn.
# AI can now use snow mana to pay for activated abilities.
SVar:RemRandomDeck:True
SVar:Rarity:Common

View File

@@ -929,7 +929,7 @@ public class AbilityFactoryAttach {
return false;
}
chance &= r.nextFloat() <= .75;
chance &= r.nextFloat() <= .9;
return chance;
}

View File

@@ -518,23 +518,48 @@ public class AbilityFactoryPump {
return false;
}
final boolean givesKws = !this.keywords.get(0).equals("none");
String[] kwPump = { "none" };
if (givesKws) {
kwPump = this.keywords.toArray(new String[this.keywords.size()]);
}
final String[] keywords = kwPump;
// when this happens we need to expand AI to consider if its ok for
// everything?
for (final Card card : cards) {
// TODO: if AI doesn't control Card and Pump is a Curse, than
// maybe use?
final Random r = MyRandom.getRandom();
// Don't add duplicate keywords
final boolean hKW = card.hasAnyKeyword(keywords);
if (givesKws && hKW) {
return false;
}
if (this.abilityFactory.isCurse()) {
if (card.getController().isComputer()) {
return false;
}
if (AllZone.getPhaseHandler().isPlayerTurn(AllZone.getComputerPlayer())
&& this.keywords.contains("Defender")) {
return false;
}
if (AllZone.getPhaseHandler().isPlayerTurn(AllZone.getHumanPlayer())
&& this.keywords.contains("HIDDEN CARDNAME can't block.")) {
return false;
}
return (r.nextFloat() <= Math.pow(.6667, activations));
}
if (((card.getNetDefense() + defense) > 0) && (!card.hasAnyKeyword(this.keywords))) {
if (card.hasSickness() && this.keywords.contains("Haste")) {
return true;
} else if (card.hasSickness() ^ this.keywords.contains("Haste")) {
return false;
} else if (this.hostCard.equals(card)) {
final Random r = MyRandom.getRandom();
if (r.nextFloat() <= Math.pow(.6667, activations)) {
return CardFactoryUtil.doesCreatureAttackAI(card) && !sa.getPayCosts().getTap();
}
} else {
final Random r = MyRandom.getRandom();
return (r.nextFloat() <= Math.pow(.6667, activations));
}
}