retire keyword "Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."

This commit is contained in:
jendave
2011-08-06 20:26:49 +00:00
parent 1cde82b3e4
commit 0df0f431ee
2 changed files with 34 additions and 71 deletions

View File

@@ -907,8 +907,8 @@ public class CombatUtil {
if(attacker.getKeyword().contains("Indestructible") && if(attacker.getKeyword().contains("Indestructible") &&
!(defender.getKeyword().contains("Wither") || defender.getKeyword().contains("Infect"))) return false; !(defender.getKeyword().contains("Wither") || defender.getKeyword().contains("Infect"))) return false;
int attBushidoMagnitude = attacker.getKeywordMagnitude("Bushido"); //unused
attBushidoMagnitude += attacker.getAmountOfKeyword("Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."); //int attBushidoMagnitude = attacker.getKeywordMagnitude("Bushido");
int defenderDamage = defender.getNetAttack() + predictPowerBonusOfBlocker(attacker, defender); int defenderDamage = defender.getNetAttack() + predictPowerBonusOfBlocker(attacker, defender);
int attackerDamage = attacker.getNetAttack() + predictPowerBonusOfAttacker(attacker, defender); int attackerDamage = attacker.getNetAttack() + predictPowerBonusOfAttacker(attacker, defender);
@@ -997,9 +997,8 @@ public class CombatUtil {
return true; return true;
} }
int attBushidoMagnitude = attacker.getKeywordMagnitude("Bushido"); //unused
attBushidoMagnitude += attacker.getAmountOfKeyword( //int attBushidoMagnitude = attacker.getKeywordMagnitude("Bushido");
"Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.");
int defenderDamage = defender.getNetAttack() + predictPowerBonusOfBlocker(attacker, defender); int defenderDamage = defender.getNetAttack() + predictPowerBonusOfBlocker(attacker, defender);
int attackerDamage = attacker.getNetAttack() + predictPowerBonusOfAttacker(attacker, defender); int attackerDamage = attacker.getNetAttack() + predictPowerBonusOfAttacker(attacker, defender);
@@ -1974,42 +1973,6 @@ public class CombatUtil {
for(Ability ab:CardFactoryUtil.getBushidoEffects(a)) for(Ability ab:CardFactoryUtil.getBushidoEffects(a))
AllZone.Stack.add(ab); AllZone.Stack.add(ab);
if(a.getKeyword().contains(
"Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.")) {
Ability ability = new Ability(a, "0") {
@Override
public void resolve() {
final Command untilEOT = new Command() {
private static final long serialVersionUID = -5476584542164560128L;
public void execute() {
if(AllZone.GameAction.isCardInPlay(a)) {
a.addTempAttackBoost(-blockers);
a.addTempDefenseBoost(-blockers);
}
}
};//Command
if(AllZone.GameAction.isCardInPlay(a)) {
a.addTempAttackBoost(blockers);
a.addTempDefenseBoost(blockers);
AllZone.EndOfTurn.addUntil(untilEOT);
}
}//resolve
};
StringBuilder sb = new StringBuilder();
sb.append(a.getName()+" - gains +1/+1 for each blocker");
ability.setStackDescription(sb.toString());
int amount = a.getAmountOfKeyword("Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.");
for(int i=0 ; i < amount ; i++)
AllZone.Stack.add(ability);
}
//Rampage //Rampage
ArrayList<String> keywords = a.getKeyword(); ArrayList<String> keywords = a.getKeyword();
Pattern p = Pattern.compile("Rampage [0-9]+"); Pattern p = Pattern.compile("Rampage [0-9]+");

View File

@@ -255,22 +255,22 @@ public class ComputerUtil_Block2
attackersLeft = new CardList(currentAttackers.toArray()); attackersLeft = new CardList(currentAttackers.toArray());
//Reinforce blockers blocking attackers with trample if life is still in danger //Reinforce blockers blocking attackers with trample if life is still in danger
if (CombatUtil.lifeInDanger(combat)) { if (CombatUtil.lifeInDanger(combat)) {
tramplingAttackers = attackers.getKeyword("Trample"); tramplingAttackers = attackers.getKeyword("Trample");
tramplingAttackers = tramplingAttackers.getKeywordsDontContain("Rampage"); //Don't make it worse tramplingAttackers = tramplingAttackers.getKeywordsDontContain("Rampage"); //Don't make it worse
tramplingAttackers = tramplingAttackers. //TODO - should check here for a "rampage-like" trigger that replaced the keyword:
getKeywordsDontContain("Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."); // "Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."
for(Card attacker : tramplingAttackers) { for(Card attacker : tramplingAttackers) {
chumpBlockers = getPossibleBlockers(attacker, blockersLeft, combat); chumpBlockers = getPossibleBlockers(attacker, blockersLeft, combat);
for(Card blocker : chumpBlockers) { for(Card blocker : chumpBlockers) {
//Add an additional blocker if the current blockers are not enough and the new one would suck some of the damage //Add an additional blocker if the current blockers are not enough and the new one would suck some of the damage
if(CombatUtil.getAttack(attacker) > CombatUtil.totalShieldDamage(attacker,combat.getBlockers(attacker)) if(CombatUtil.getAttack(attacker) > CombatUtil.totalShieldDamage(attacker,combat.getBlockers(attacker))
&& CombatUtil.shieldDamage(attacker, blocker) > 0 && CombatUtil.canBlock(attacker,blocker, combat) && CombatUtil.shieldDamage(attacker, blocker) > 0 && CombatUtil.canBlock(attacker,blocker, combat)
&& CombatUtil.lifeInDanger(combat)) { && CombatUtil.lifeInDanger(combat)) {
combat.addBlocker(attacker, blocker); combat.addBlocker(attacker, blocker);
blockersLeft.remove(blocker); blockersLeft.remove(blocker);
} }
} }
} }
@@ -279,8 +279,8 @@ public class ComputerUtil_Block2
//Support blockers not destroying the attacker with more blockers to try to kill the attacker //Support blockers not destroying the attacker with more blockers to try to kill the attacker
if (blockedButUnkilled.size() > 0) { if (blockedButUnkilled.size() > 0) {
CardList targetAttackers = blockedButUnkilled.getKeywordsDontContain("Rampage"); //Don't make it worse CardList targetAttackers = blockedButUnkilled.getKeywordsDontContain("Rampage"); //Don't make it worse
targetAttackers = targetAttackers. //TODO - should check here for a "rampage-like" trigger that replaced the keyword:
getKeywordsDontContain("Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."); // "Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."
for(Card attacker : targetAttackers) { for(Card attacker : targetAttackers) {
blockers = getPossibleBlockers(attacker, blockersLeft, combat); blockers = getPossibleBlockers(attacker, blockersLeft, combat);
@@ -288,13 +288,13 @@ public class ComputerUtil_Block2
//Try to use safe blockers first //Try to use safe blockers first
safeBlockers = getSafeBlockers(attacker, blockers); safeBlockers = getSafeBlockers(attacker, blockers);
for(Card blocker : safeBlockers) { for(Card blocker : safeBlockers) {
//Add an additional blocker if the current blockers are not enough and the new one would deal additional damage //Add an additional blocker if the current blockers are not enough and the new one would deal additional damage
if(attacker.getKillDamage() > CombatUtil.totalDamageOfBlockers(attacker,combat.getBlockers(attacker)) if(attacker.getKillDamage() > CombatUtil.totalDamageOfBlockers(attacker,combat.getBlockers(attacker))
&& CombatUtil.dealsDamageAsBlocker(attacker, blocker) > 0 && CombatUtil.canBlock(attacker,blocker, combat)) { && CombatUtil.dealsDamageAsBlocker(attacker, blocker) > 0 && CombatUtil.canBlock(attacker,blocker, combat)) {
combat.addBlocker(attacker, blocker); combat.addBlocker(attacker, blocker);
blockersLeft.remove(blocker); blockersLeft.remove(blocker);
} }
blockers.remove(blocker); //Don't check them again next blockers.remove(blocker); //Don't check them again next
} }
//Try to add blockers that could be destroyed, but are worth less than the attacker //Try to add blockers that could be destroyed, but are worth less than the attacker
@@ -306,15 +306,15 @@ public class ComputerUtil_Block2
else safeBlockers = new CardList(blockers.toArray()); else safeBlockers = new CardList(blockers.toArray());
for(Card blocker : safeBlockers) { for(Card blocker : safeBlockers) {
//Add an additional blocker if the current blockers are not enough and the new one would deal the remaining damage //Add an additional blocker if the current blockers are not enough and the new one would deal the remaining damage
int currentDamage = CombatUtil.totalDamageOfBlockers(attacker,combat.getBlockers(attacker)); int currentDamage = CombatUtil.totalDamageOfBlockers(attacker,combat.getBlockers(attacker));
int additionalDamage = CombatUtil.dealsDamageAsBlocker(attacker, blocker); int additionalDamage = CombatUtil.dealsDamageAsBlocker(attacker, blocker);
if(attacker.getKillDamage() > currentDamage if(attacker.getKillDamage() > currentDamage
&& !(attacker.getKillDamage() > currentDamage + additionalDamage) && !(attacker.getKillDamage() > currentDamage + additionalDamage)
&& CardFactoryUtil.evaluateCreature(blocker) + diff < CardFactoryUtil.evaluateCreature(attacker) && CardFactoryUtil.evaluateCreature(blocker) + diff < CardFactoryUtil.evaluateCreature(attacker)
&& CombatUtil.canBlock(attacker,blocker,combat)) { && CombatUtil.canBlock(attacker,blocker,combat)) {
combat.addBlocker(attacker, blocker); combat.addBlocker(attacker, blocker);
blockersLeft.remove(blocker); blockersLeft.remove(blocker);
} }
} }
} }