forked from External/mage
* Make ChoosePlaneswalkerTypeEffect * Make REMOVE_COUNTER and REMOVE_COUNTERS events so they can be replaced/modified * Deification initial attempt, need to filter for damage * add optional damage flag to removeCounters * wrap logs in sim check * check that planeswalker is chosen subtype * cast to RemoveCountersEvent and reduce indents * use counterRemovedDueToDamage * add tests * make other counterRemovedDueToDamage headers public * remove logs * remove isSimulation check from informPlayers * remove logger * make chosen planeswalker type predicate * move event modification to replaceEvent
33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
package mage.game.events;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.cards.Card;
|
|
import mage.players.Player;
|
|
|
|
public class RemoveCountersEvent extends GameEvent {
|
|
|
|
boolean isDamage;
|
|
|
|
public RemoveCountersEvent(String name, Card targetCard, Ability source, int amount, boolean isDamage){
|
|
super(EventType.REMOVE_COUNTERS, targetCard.getId(), source,
|
|
targetCard.getControllerOrOwnerId(), amount, false);
|
|
|
|
if (source != null && source.getControllerId() != null) {
|
|
setPlayerId(source.getControllerId()); // player who controls the source ability that removed the counters
|
|
}
|
|
setData(name);
|
|
this.isDamage = isDamage;
|
|
}
|
|
|
|
public RemoveCountersEvent(String name, Player targetPlayer, Ability source, int amount, boolean isDamage){
|
|
super(EventType.REMOVE_COUNTERS, targetPlayer.getId(), source,
|
|
(source == null ? null : source.getControllerId()), amount, false);
|
|
setData(name);
|
|
this.isDamage = isDamage;
|
|
}
|
|
|
|
public boolean counterRemovedDueToDamage(){
|
|
return this.isDamage;
|
|
}
|
|
|
|
}
|