1) Add source of poisoning for players.

2) Add poisoning to GameLog (shown by default)
This commit is contained in:
slapshot5
2011-12-05 03:10:42 +00:00
parent 760925f870
commit 30b106910b
7 changed files with 17 additions and 16 deletions

View File

@@ -388,7 +388,7 @@ public class GameAction {
}
if (c.hasKeyword("If CARDNAME is put into a graveyard this turn, its controller gets a poison counter.")) {
c.getController().addPoisonCounters(1);
c.getController().addPoisonCounters(1, c);
}
// must put card in OWNER's graveyard not controller's

View File

@@ -906,12 +906,7 @@ public final class GameActionUtil {
public void resolve() {
final Player player = crd.getController();
final Player opponent = player.getOpponent();
if (opponent.isHuman()) {
AllZone.getHumanPlayer().addPoisonCounters(poison);
} else {
AllZone.getComputerPlayer().addPoisonCounters(poison);
}
opponent.addPoisonCounters(poison, c);
}
};
@@ -921,7 +916,11 @@ public final class GameActionUtil {
sb.append(c.getController().getOpponent());
sb.append(" gets ");
sb.append(poison);
sb.append(" poison counters.");
sb.append(" poison counter");
if (poison != 1) {
sb.append("s");
}
sb.append(".");
ability.setStackDescription(sb.toString());
final ArrayList<String> keywords = c.getKeyword();

View File

@@ -12,6 +12,7 @@ import java.util.ArrayList;
* Logging level:
* 0 - Turn
* 2 - Stack items
* 3 - Poison Counters
* 4 - Mana abilities
* 6 - All Phase information
*

View File

@@ -470,7 +470,7 @@ public abstract class Player extends GameEntity {
final int damageToDo = damage;
if (source.hasKeyword("Infect")) {
this.addPoisonCounters(damageToDo);
this.addPoisonCounters(damageToDo, source);
} else {
// Worship does not reduce the damage dealt but changes the effect
// of the damage
@@ -841,9 +841,10 @@ public abstract class Player extends GameEntity {
* @param num
* a int.
*/
public final void addPoisonCounters(final int num) {
public final void addPoisonCounters(final int num, final Card source) {
if (!this.hasKeyword("You can't get poison counters")) {
this.poisonCounters += num;
AllZone.getGameLog().add("Poison", this + " receives a poison counter from " + source, 3);
this.updateObservers();
}
}

View File

@@ -985,7 +985,7 @@ public class AbilityFactoryAlterLife {
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
p.addPoisonCounters(amount);
p.addPoisonCounters(amount, sa.getSourceCard());
}
}
}

View File

@@ -1355,13 +1355,13 @@ public class AbilityFactoryCounters {
if (player.isHuman() && (!this.selHuman)) {
this.selHuman = true;
if (AllZone.getHumanPlayer().getPoisonCounters() > 0) {
AllZone.getHumanPlayer().addPoisonCounters(1);
AllZone.getHumanPlayer().addPoisonCounters(1, sa.getSourceCard());
}
}
if (player.isComputer() && (!this.selComputer)) {
this.selComputer = true;
if (AllZone.getComputerPlayer().getPoisonCounters() > 0) {
AllZone.getComputerPlayer().addPoisonCounters(1);
AllZone.getComputerPlayer().addPoisonCounters(1, sa.getSourceCard());
}
}
}
@@ -1452,7 +1452,7 @@ public class AbilityFactoryCounters {
// give human a poison counter, if he has one
if (AllZone.getHumanPlayer().getPoisonCounters() > 0) {
AllZone.getHumanPlayer().addPoisonCounters(1);
AllZone.getHumanPlayer().addPoisonCounters(1, sa.getSourceCard());
}
} // comp

View File

@@ -299,9 +299,9 @@ public class ViewTabber extends FRoundedPanel {
final Font font = this.skin.getFont1().deriveFont(Font.PLAIN, 14);
final Border border = new MatteBorder(0, 0, 1, 0, this.skin.getClrBorders());
//by default, grab everything logging level 2 or less
//by default, grab everything logging level 3 or less
//TODO - some option to make this configurable is probably desirable
JTextArea tar = new JTextArea(gl.getLogText(2));
JTextArea tar = new JTextArea(gl.getLogText(3));
tar.setOpaque(false);
tar.setBorder(border);
tar.setFont(font);