- Changed some of the damage dealing code (it's much more centralized now), there's also a difference now between dealing damage and dealing combat damage (Mirri the Cursed shouldn't get counters anymore if she damages creatures through non-combat damage). Hopefully this update didn't cause too many bugs...

- Added Infect keyword, plus a few Scars of Mirrodin cards.
This commit is contained in:
jendave
2011-08-06 06:04:22 +00:00
parent 3ed8b68d29
commit a0d1f46608
12 changed files with 156 additions and 114 deletions

View File

@@ -1,3 +1,34 @@
Memnite
no cost
Artifact Creature Construct
no text
1/1
SVar:Rarity:Uncommon
Darksteel Axe
1
Artifact Equipment
Equipped creature gets +2/+0.
Indestructible
eqPump 2:+2/+0
SVar:Rarity:Common
Tempered Steel
1 W W
Enchantment
no text
StaticEffect:Play:Permanents you Control:PTBonus/2/2:Type.Creature!Type.Artifact:Artifact creatures you control get +2/+2.
Skithiryx, the Blight Dragon
3 B B
Legendary Creature Dragon Skeleton
no text
4/4
Flying
Infect
RegenerateMe:B B
abPump B:Haste
Ravenous Baloth
2 G G
Creature Beast

View File

@@ -2048,7 +2048,7 @@ public class CardFactory implements NewConstants {
tgtP = c.getController();
}
} else {
AllZone.GameAction.addDamage(getTargetPlayer(), damage,card);
AllZone.GameAction.addDamage(getTargetPlayer(), card, damage);
tgtP = getTargetPlayer();
}
@@ -8792,7 +8792,7 @@ public class CardFactory implements NewConstants {
}
else{
JOptionPane.showMessageDialog(null, "Bottle of Suleiman - Lose - Bottle does 5 damage to "+player+".", "Bottle of Suleiman", JOptionPane.PLAIN_MESSAGE);
AllZone.GameAction.addDamage(card.getController(), 5, card);
AllZone.GameAction.addDamage(card.getController(), card, 5);
}
}
};//SpellAbility

View File

@@ -3755,7 +3755,7 @@ public class CardFactoryUtil {
else if (d[0].contains("DamageSelf"))
AllZone.GameAction.addDamage(Src, Src, X); // 2/10
else if(d[0].contains("Damage"))
AllZone.GameAction.addDamage(dbPlayer, X, Src);
AllZone.GameAction.addDamage(dbPlayer, Src, X);
if(d[0].contains("GainLife"))

View File

@@ -1455,7 +1455,7 @@ public class CardFactory_Creatures {
//*************** START *********** START **************************
else if(cardName.equals("Venerable Monk") || cardName.equals("Kitchen Finks")
|| cardName.equals("Shu Grain Caravan")) {
|| cardName.equals("Shu Grain Caravan") || cardName.equals("Kemba's Skyguard")) {
final SpellAbility ability = new Ability(card, "0") {
@Override
public void resolve() {
@@ -19231,7 +19231,7 @@ public class CardFactory_Creatures {
Card c = getTargetCard();
if (c != null)
AllZone.GameAction.sacrifice(c);
AllZone.GameAction.addDamage(card.getController(), 1, card);
AllZone.GameAction.addDamage(card.getController(), card, 1);
}
};

View File

@@ -4057,8 +4057,8 @@ public class CardFactory_Instants {
for(int i = 0; i < all.size(); i++)
all.get(i).addDamage(card.getXManaCostPaid(), card);
AllZone.GameAction.addDamage(Constant.Player.Human, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Computer, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Human, card, damage);
AllZone.GameAction.addDamage(Constant.Player.Computer, card, damage);
card.setXManaCostPaid(0);
}
@@ -4123,8 +4123,8 @@ public class CardFactory_Instants {
for(int i = 0; i < all.size(); i++)
all.get(i).addDamage(card.getXManaCostPaid(), card);
AllZone.GameAction.addDamage(Constant.Player.Human, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Computer, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Human, card, damage);
AllZone.GameAction.addDamage(Constant.Player.Computer, card, damage);
card.setXManaCostPaid(0);
}
@@ -4990,7 +4990,7 @@ public class CardFactory_Instants {
if( damage < 0 )
damage = 0;
AllZone.GameAction.addDamage(getTargetPlayer(), damage, card);
AllZone.GameAction.addDamage(getTargetPlayer(), card, damage);
}
};
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
@@ -5162,8 +5162,8 @@ public class CardFactory_Instants {
for(Card c:all) {
AllZone.GameAction.addDamage(c, card, damage);
}
AllZone.GameAction.addDamage(Constant.Player.Computer, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Human, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Computer, card, damage);
AllZone.GameAction.addDamage(Constant.Player.Human, card, damage);
}// resolve()
@Override

View File

@@ -3094,7 +3094,7 @@ class CardFactory_Planeswalkers {
for(int i = 0; i < dragons.size(); i++) {
Card dragon = dragons.get(i);
int damage = dragon.getNetAttack();
AllZone.GameAction.addDamage(target, damage, dragon);
AllZone.GameAction.addDamage(target, dragon, damage);
}
}//resolve()

View File

@@ -5878,8 +5878,8 @@ public class CardFactory_Sorceries {
for(int i = 0; i < all.size(); i++)
all.get(i).addDamage(card.getXManaCostPaid(), card);
AllZone.GameAction.addDamage(Constant.Player.Human, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Computer, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Human, card, damage);
AllZone.GameAction.addDamage(Constant.Player.Computer, card, damage);
card.setXManaCostPaid(0);
}
@@ -5947,8 +5947,8 @@ public class CardFactory_Sorceries {
for(int i = 0; i < all.size(); i++)
all.get(i).addDamage(card.getXManaCostPaid(), card);
AllZone.GameAction.addDamage(Constant.Player.Human, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Computer, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Human, card, damage);
AllZone.GameAction.addDamage(Constant.Player.Computer, card, damage);
card.setXManaCostPaid(0);
}
@@ -6104,8 +6104,8 @@ public class CardFactory_Sorceries {
for(int i = 0; i < all.size(); i++)
all.get(i).addDamage(card.getXManaCostPaid(), card);
AllZone.GameAction.addDamage(Constant.Player.Human, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Computer, damage,card);
AllZone.GameAction.addDamage(Constant.Player.Human, card, damage);
AllZone.GameAction.addDamage(Constant.Player.Computer, card, damage);
card.setXManaCostPaid(0);
}
@@ -6291,7 +6291,7 @@ public class CardFactory_Sorceries {
list.get(i).addDamage(card.getXManaCostPaid(), card);
}
AllZone.GameAction.addDamage(player, damage,card);
AllZone.GameAction.addDamage(player, card, damage);
card.setXManaCostPaid(0);
}
public boolean canPlayAI()
@@ -7135,8 +7135,8 @@ public class CardFactory_Sorceries {
CardList humanLands = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Human);
CardList compLands = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Computer);
AllZone.GameAction.addDamage(Constant.Player.Computer, compLands.size(), card);
AllZone.GameAction.addDamage(Constant.Player.Human, humanLands.size(), card);
AllZone.GameAction.addDamage(Constant.Player.Computer, card, compLands.size());
AllZone.GameAction.addDamage(Constant.Player.Human, card, humanLands.size());
}// resolve()
@Override
@@ -7224,7 +7224,7 @@ public class CardFactory_Sorceries {
} else {
javax.swing.JOptionPane.showMessageDialog(null, cardName+" causes " + damage
+ " to " + getTargetPlayer());
AllZone.GameAction.addDamage(getTargetPlayer(), damage, card);
AllZone.GameAction.addDamage(getTargetPlayer(), card, damage);
}
//System.out.println("Library after: "+AllZoneUtil.getPlayerCardsInLibrary(card.getController()));
}

View File

@@ -59,6 +59,16 @@ public class Combat
//relates to defending player damage
//public int getDefendingDamage() {return defendingDamage;}
public HashMap<Card, Integer> getDefendingDamageMap()
{
return defendingDamageMap;
}
public HashMap<Card, Integer> getDefendingFirstStrikeDamageMap()
{
return defendingFirstStrikeDamageMap;
}
public int getTotalDefendingDamage()
{
int total = 0;

View File

@@ -1791,11 +1791,11 @@ public class GameAction {
AllZone.GameAction.addDamage(c, F_card, F_Amount[0]);
}
} else {
AllZone.GameAction.addDamage( (String) Targets_Multi[z], F_Amount[0],F_card);
AllZone.GameAction.addDamage( (String) Targets_Multi[z], F_card, F_Amount[0]);
}
}
}
if(F_card.getController().equals(Constant.Player.Computer)) AllZone.GameAction.addDamage(Constant.Player.Human, F_Amount[0]*F_Multiple_Targets,F_card);
if(F_card.getController().equals(Constant.Player.Computer)) AllZone.GameAction.addDamage(Constant.Player.Human, F_card, F_Amount[0]*F_Multiple_Targets);
}
}
};
@@ -3561,7 +3561,7 @@ public class GameAction {
*/
}
public void addDamage(Card card, HashMap<Card, Integer> map) {
public void addCombatDamage(Card card, HashMap<Card, Integer> map) {
//int totalDamage = 0;
CardList list = new CardList();
@@ -3572,7 +3572,7 @@ public class GameAction {
int damageToAdd = damage;
//AllZone.GameAction.addDamage(c, crd , assignedDamageMap.get(crd));
if(source.getKeyword().contains("Wither") && card.isCreature()) {
if((source.getKeyword().contains("Wither") || source.getKeyword().contains("Infect")) && card.isCreature()) {
damageToAdd = 0;
card.addCounterFromNonEffect(Counters.M1M1, damage);
}
@@ -3597,17 +3597,20 @@ public class GameAction {
map.put(source, damageToAdd);
}
if(isCardInPlay(card)) card.addDamage(map);
if(isCardInPlay(card)) {
card.addDamage(map);
CombatUtil.executeCombatDamageEffects(card);
}
}
public void addDamage(Card card, Card source, int damage) {
int damageToAdd = damage;
if(source.getKeyword().contains("Wither") && card.isCreature()) {
if((source.getKeyword().contains("Wither") || source.getKeyword().contains("Infect")) && card.isCreature()) {
damageToAdd = 0;
card.addCounterFromNonEffect(Counters.M1M1, damage);
}
if(source.getName().equals("Spiritmonger") || source.getName().equals("Mirri the Cursed")) {
if(source.getName().equals("Spiritmonger")) {
final Card thisCard = source;
Ability ability2 = new Ability(source, "0") {
@Override
@@ -3676,49 +3679,7 @@ public class GameAction {
}
}
/*
public void counterSpell()
{
SpellAbility s;
boolean spellOnStack = false;
for (int i=0; i<AllZone.Stack.size(); i++)
{
s = AllZone.Stack.peek(i);
if (s.isSpell()) {
spellOnStack = true;
break;
}
}
if (!spellOnStack)
return;
SpellAbility sa = AllZone.Stack.peek();
//SpellAbility sa = AllZone.Stack.pop();
while (!sa.isSpell() || AllZone.Stack.size() == 0)
{
sa = AllZone.Stack.peek();
sa.resolve();
}
if (sa.isSpell())
AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
}
*/
/**
public void addLife(String player, int life) {
// place holder for future life gain modification rules
getPlayerLife(player).addLife(life);
}
public void subLife(String player, int life) {
// place holder for future life loss modification rules
getPlayerLife(player).subtractLife(life);
}
**/
public void addDamage(String player, int damage, Card source) {
// place holder for future damage modification rules (prevention?)
@@ -3730,16 +3691,34 @@ public class GameAction {
}
getPlayerLife(player).subtractLife(damage,source);
}
/**
public void addDamage(String player, int damage) {
// place holder for future damage modification rules (prevention?)
getPlayerLife(player).subtractLife(damage);
*/
public void addCombatDamage(String player, Card source, int damage)
{
//addDamage(player, source, damage);
if (source.getKeyword().contains("Infect"))
{
if(player.equals(Constant.Player.Human))
AllZone.Human_PoisonCounter.addPoisonCounters(damage);
else
AllZone.Computer_PoisonCounter.addPoisonCounters(damage);
}
else
getPlayerLife(player).subtractLife(damage,source);
CombatUtil.executeCombatDamageEffects(source);
}
**/
public void addDamage(String player, Card source, int damage) {
getPlayerLife(player).subtractLife(damage,source);
if (source.getKeyword().contains("Infect"))
{
if(player.equals(Constant.Player.Human))
AllZone.Human_PoisonCounter.addPoisonCounters(damage);
else
AllZone.Computer_PoisonCounter.addPoisonCounters(damage);
}
else
getPlayerLife(player).subtractLife(damage,source);
if(source.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects(source, damage);
CardList cl = CardFactoryUtil.getAurasEnchanting(source, "Guilty Conscience");

View File

@@ -155,7 +155,7 @@ public class GameActionUtil {
Ability ability = new Ability(c, "0") {
@Override
public void resolve() {
AllZone.GameAction.addDamage(player, 1, crd);
AllZone.GameAction.addDamage(player, crd, 1);
}
};// Ability
ability.setStackDescription("City of Brass deals 1 damage to " + player);
@@ -5084,6 +5084,29 @@ public class GameActionUtil {
}
}
/*
if (c.getKeyword().contains("Infect"))
{
final String player = AllZone.GameAction.getOpponent(c.getController());
final int power = c.getNetAttack();
if(power > 0) {
Ability ability2 = new Ability(c, "0") {
@Override
public void resolve() {
if(player.equals(Constant.Player.Human))
AllZone.Human_PoisonCounter.addPoisonCounters(power);
else
AllZone.Computer_PoisonCounter.addPoisonCounters(power);
}
};// ability2
ability2.setStackDescription(c.getName() + " - " + player + " gets " + power + " poison counter(s).");
AllZone.Stack.add(ability2);
} // if
}
*/
if(CardFactoryUtil.hasNumberEquipments(c, "Mask of Riddles") > 0 && c.getNetAttack() > 0) {
for(int k = 0; k < CardFactoryUtil.hasNumberEquipments(c, "Mask of Riddles"); k++) {
playerCombatDamage_May_draw(c);
@@ -8683,7 +8706,7 @@ public class GameActionUtil {
@Override
public void resolve() {
AllZone.GameAction.addDamage(player, 1, crd);
AllZone.GameAction.addDamage(player, crd, 1);
}
};// Ability
ability.setStackDescription("Serendib Efreet - deals 1 damage to " + player);
@@ -8705,7 +8728,7 @@ public class GameActionUtil {
ability = new Ability(list.get(i), "0") {
@Override
public void resolve() {
AllZone.GameAction.addDamage(player, 1, crd);
AllZone.GameAction.addDamage(player, crd, 1);
}
};// Ability
ability.setStackDescription("Nettletooth Djinn - deals 1 damage to " + player);
@@ -9201,7 +9224,7 @@ public class GameActionUtil {
ability = new Ability(list.get(i), "0") {
@Override
public void resolve() {
AllZone.GameAction.addDamage(player, 1, crd);
AllZone.GameAction.addDamage(player, crd, 1);
}
};// Ability
ability.setStackDescription("Juzam Djinn - deals 1 damage to " + player);
@@ -9223,7 +9246,7 @@ public class GameActionUtil {
ability = new Ability(list.get(i), "0") {
@Override
public void resolve() {
AllZone.GameAction.addDamage(player, 1, crd);
AllZone.GameAction.addDamage(player, crd, 1);
}
};// Ability

View File

@@ -61,9 +61,17 @@ public class Input_CombatDamage extends Input {
String player = AllZone.Combat.getDefendingPlayer();
if(player.equals("")) //this is a really bad hack, to allow raging goblin to attack on turn 1
player = Constant.Player.Computer;
PlayerLife life = AllZone.GameAction.getPlayerLife(player);
life.subtractLife(AllZone.Combat.getTotalDefendingDamage(),AllZone.CardFactory.HumanNullCard);
HashMap<Card, Integer> defMap = AllZone.Combat.getDefendingDamageMap();
for(Entry<Card, Integer> entry : defMap.entrySet()) {
AllZone.GameAction.addCombatDamage(player, entry.getKey(), entry.getValue());
//this.addDamage(entry.getValue(), entry.getKey());
}
//PlayerLife life = AllZone.GameAction.getPlayerLife(player);
//life.subtractLife(AllZone.Combat.getTotalDefendingDamage(),AllZone.CardFactory.HumanNullCard);
// Quick Fix, should work for Whenever keyword because of GameActionUtil.ExecutePlayerCombatEffects
@@ -112,23 +120,17 @@ public class Input_CombatDamage extends Input {
}
}
*/
/*
if(!attackers.getCard(i).hasDoubleStrike()
|| (attackers.getCard(i).hasDoubleStrike() && !AllZone.Combat.isBlocked(attackers.getCard(i)))
|| (attackers.getCard(i).hasDoubleStrike()
&& AllZone.Combat.isBlocked(attackers.getCard(i)) && defend.size() != 0)) {
/*
//old stuff: lifelink triggers on multiple instances of the lifelink keyword
for (int j=0; j < list.size(); j++)
{
if (list.get(j).equals("Lifelink"))
GameActionUtil.executeLifeLinkEffects(attackers.getCard(i));
}
*/
CombatUtil.executeCombatDamageEffects(attackers.getCard(i));
}
*/
//not sure if this will work correctly with multiple blockers?
int defenderToughness = 0;
for(int k = 0; k < defend.size(); k++) {
@@ -247,7 +249,7 @@ public class Input_CombatDamage extends Input {
damageMap.put(crd, entry.getValue());
}
AllZone.GameAction.addDamage(c, damageMap);
AllZone.GameAction.addCombatDamage(c, damageMap);
AllZone.GameAction.checkWinLoss();

View File

@@ -68,8 +68,16 @@ public class Input_FirstStrikeDamage extends Input {
String player = AllZone.Combat.getDefendingPlayer();
if(player.equals("")) //this is a really bad hack, to allow raging goblin to attack on turn 1
player = Constant.Player.Computer;
PlayerLife life = AllZone.GameAction.getPlayerLife(player);
life.subtractLife(AllZone.Combat.getTotalFirstStrikeDefendingDamage(),AllZone.CardFactory.HumanNullCard);
HashMap<Card, Integer> defMap = AllZone.Combat.getDefendingFirstStrikeDamageMap();
for(Entry<Card, Integer> entry : defMap.entrySet()) {
AllZone.GameAction.addCombatDamage(player, entry.getKey(), entry.getValue());
//this.addDamage(entry.getValue(), entry.getKey());
}
//PlayerLife life = AllZone.GameAction.getPlayerLife(player);
//life.subtractLife(AllZone.Combat.getTotalFirstStrikeDefendingDamage(),AllZone.CardFactory.HumanNullCard);
// Quick Fix, should work for Whenever keyword because of GameActionUtil.ExecutePlayerCombatEffects
Log.debug("getTotalFirstStrikeDefendingDamage: "
+ AllZone.Combat.getTotalFirstStrikeDefendingDamage());
@@ -103,22 +111,11 @@ public class Input_FirstStrikeDamage extends Input {
CardList defend = AllZone.Combat.getBlockers(attackers.getCard(i));
ArrayList<String> list = attackers.getCard(i).getKeyword();
/*
if((attackers.getCard(i).hasFirstStrike() || attackers.getCard(i).hasDoubleStrike())) {
CombatUtil.executeCombatDamageEffects(attackers.getCard(i));
/*
//old stuff: gain life for each instance of lifelink
for (int j=0; j < list.size(); j++)
{
if (list.get(j).equals("Lifelink"))
GameActionUtil.executeLifeLinkEffects(attackers.getCard(i));
}
*/
}
}*/
//not sure if this will work correctly with multiple blockers?
int defenderToughness = 0;
@@ -183,7 +180,7 @@ public class Input_FirstStrikeDamage extends Input {
damageMap.put(crd, entry.getValue());
}
AllZone.GameAction.addDamage(c, damageMap);
AllZone.GameAction.addCombatDamage(c, damageMap);
AllZone.GameAction.checkWinLoss();