Make order of parameters the same for methods player.damage and permanent.damage

This commit is contained in:
Quercitron 2014-07-18 02:11:11 +04:00
parent f81af16fa4
commit e5b2b39701
139 changed files with 162 additions and 162 deletions

View file

@ -1337,7 +1337,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID sourceId, Game game) {
log.debug("assignDamage");
//TODO: improve this
game.getPermanent(targets.get(0)).damage(damage, sourceId, game, true, false);
game.getPermanent(targets.get(0)).damage(damage, sourceId, game, false, true);
}
@Override

View file

@ -429,7 +429,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
}
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.damage(amount, sourceId, game, true, false);
permanent.damage(amount, sourceId, game, false, true);
remainingDamage -= amount;
}
else {

View file

@ -803,7 +803,7 @@ public class HumanPlayer extends PlayerImpl {
int damageAmount = getAmount(0, remainingDamage, "Select amount", game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
permanent.damage(damageAmount, sourceId, game, true, false);
permanent.damage(damageAmount, sourceId, game, false, true);
remainingDamage -= damageAmount;
}
else {

View file

@ -107,7 +107,7 @@ class LavalancheEffect extends OneShotEffect {
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getId(), game);
for (Permanent permanent: permanents) {
permanent.damage(amount.calculate(game, source), source.getSourceId(), game, true, false);
permanent.damage(amount.calculate(game, source), source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -102,7 +102,7 @@ class VengefulRebirthEffect extends OneShotEffect {
int damage = card.getManaCost().convertedManaCost();
Permanent permanent = game.getPermanent(source.getTargets().get(1).getTargets().get(0));
if (permanent != null) {
permanent.damage(damage, source.getSourceId(), game, true, false);
permanent.damage(damage, source.getSourceId(), game, false, true);
}
Player targetPlayer = game.getPlayer(source.getTargets().get(1).getTargets().get(0));
if (targetPlayer != null) {

View file

@ -121,7 +121,7 @@ class OrimsThunderEffect2 extends OneShotEffect {
}
boolean kicked = KickedCondition.getInstance().apply(game, source);
if (kicked && secondTarget != null) {
secondTarget.damage(damage, source.getId(), game, true, false);
secondTarget.damage(damage, source.getId(), game, false, true);
return true;
}
return false;

View file

@ -99,7 +99,7 @@ class AggraveteEffect extends OneShotEffect {
filter.add(new ControllerIdPredicate(player.getId()));
List<Permanent> creatures = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getId(), game);
for (Permanent creature : creatures) {
creature.damage(1, source.getSourceId(), game, true, false);
creature.damage(1, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -95,7 +95,7 @@ class BonfireOfTheDamnedEffect extends OneShotEffect {
if (damage > 0) {
player.damage(damage, source.getId(), game, false, true);
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
perm.damage(damage, source.getId(), game, true, false);
perm.damage(damage, source.getId(), game, false, true);
}
return true;
}

View file

@ -101,7 +101,7 @@ class BurnAtTheStakeEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, true, false);
permanent.damage(amount, source.getSourceId(), game, false, true);
return true;
}

View file

@ -124,7 +124,7 @@ class DivineDeflectionPreventDamageTargetEffect extends PreventionEffectImpl {
if (permanent != null) {
game.informPlayers("Dealing " + prevented + " to " + permanent.getName() + " instead");
// keep the original source id as it is redirecting
permanent.damage(prevented, event.getSourceId(), game, true, false);
permanent.damage(prevented, event.getSourceId(), game, false, true);
}
Player player = game.getPlayer(redirectTo);
if (player != null) {

View file

@ -97,7 +97,7 @@ public class AuraBarbs extends CardImpl {
if (auraEnchantment.getAttachedTo() != null) {
Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo());
if (attachedToCreature != null && attachedToCreature.getCardType().contains(CardType.CREATURE)) {
attachedToCreature.damage(2, auraEnchantment.getId(), game, true, false);
attachedToCreature.damage(2, auraEnchantment.getId(), game, false, true);
game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from " + auraEnchantment.getName());
}
}

View file

@ -89,7 +89,7 @@ class FirstVolleyEffect extends OneShotEffect {
if (permanent != null) {
Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null) {
permanent.damage(1, source.getSourceId(), game, true, false);
permanent.damage(1, source.getSourceId(), game, false, true);
controller.damage(1, source.getSourceId(), game, false, true);
return true;
}

View file

@ -149,7 +149,7 @@ class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl {
game.informPlayers(message.toString());
// redirect damage
this.used = true;
sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage(), event.getAppliedEffects());
sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
return true;
}
return false;

View file

@ -99,7 +99,7 @@ class RoninCliffriderEffect extends OneShotEffect {
filter.add(new ControllerIdPredicate(defenderId));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
for (Permanent permanent : permanents) {
permanent.damage(1, source.getSourceId(), game, true, false);
permanent.damage(1, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -145,7 +145,7 @@ class ShiningShoalPreventDamageTargetEffect extends PreventionEffectImpl {
if (permanent != null) {
game.informPlayers("Dealing " + prevented + " to " + permanent.getName() + " instead");
// keep the original source id as it is redirecting
permanent.damage(prevented, event.getSourceId(), game, true, false, event.getAppliedEffects());
permanent.damage(prevented, event.getSourceId(), game, false, true, event.getAppliedEffects());
}
Player player = game.getPlayer(redirectTo);
if (player != null) {

View file

@ -115,7 +115,7 @@ class ShurikenDamageEffect extends OneShotEffect {
if (equipment != null) {
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (creature != null) {
creature.damage(2, equipment.getId(), game, true, false);
creature.damage(2, equipment.getId(), game, false, true);
}
return true;
}

View file

@ -137,7 +137,7 @@ class AcolytesRewardEffect extends PreventionEffectImpl {
} else {
Permanent targetDamageCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (targetDamageCreature != null) {
targetDamageCreature.damage(toPrevent, source.getSourceId(), game, true, false);
targetDamageCreature.damage(toPrevent, source.getSourceId(), game, false, true);
game.informPlayers(new StringBuilder("Acolyte's Reward ").append("deals ").append(toPrevent).append(" damage to ").append(targetDamageCreature.getName()).toString());
}
}

View file

@ -106,7 +106,7 @@ class FallOfTheHammerDamageEffect extends OneShotEffect {
int damage = ownCreature.getPower().getValue();
Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (targetCreature != null) {
targetCreature.damage(damage, ownCreature.getId(), game, true, false);
targetCreature.damage(damage, ownCreature.getId(), game, false, true);
return true;
}
}

View file

@ -167,7 +167,7 @@ class SatyrFiredancerDamageEffect extends OneShotEffect {
if (targetCreature != null && controller != null) {
int damage = (Integer) this.getValue("damage");
if (damage > 0) {
targetCreature.damage(damage, source.getSourceId(), game, true, false);
targetCreature.damage(damage, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -146,7 +146,7 @@ class HankyuDealsDamageEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(damageAmount, source.getSourceId(), game, true, false);
permanent.damage(damageAmount, source.getSourceId(), game, false, true);
}
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {

View file

@ -103,7 +103,7 @@ class KikuNightsFlowerEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, true, false);
permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true);
return true;
}
return false;

View file

@ -152,7 +152,7 @@ class KusariGamaDamageEffect extends OneShotEffect {
if (!blockerId.equals(damagedCreatureId)) {
Permanent blockingCreature = game.getPermanent(blockerId);
if (blockingCreature != null && blockingCreature.getControllerId().equals(creature.getControllerId())) {
blockingCreature.damage(damage, source.getSourceId(), game, true, false);
blockingCreature.damage(damage, source.getSourceId(), game, false, true);
}
}
}

View file

@ -96,7 +96,7 @@ class SuddenDemiseDamageEffect extends OneShotEffect {
FilterPermanent filter = new FilterCreaturePermanent();
filter.add(new ColorPredicate(choice.getColor()));
for (Permanent permanent:game.getBattlefield().getActivePermanents(filter, source.getControllerId(), id, game)) {
permanent.damage(damage, source.getSourceId(), game, true, false);
permanent.damage(damage, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -128,7 +128,7 @@ class BaneFireEffect extends OneShotEffect {
return true;
}
if (targetCreature != null) {
targetCreature.damage(damage, source.getSourceId(), game, false, preventable);
targetCreature.damage(damage, source.getSourceId(), game, preventable, false);
return true;
}
return false;

View file

@ -96,7 +96,7 @@ class DarkTemperEffect extends OneShotEffect {
filter.add(new ColorPredicate(ObjectColor.BLACK));
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) == 0) {
permanent.damage(2, source.getSourceId(), game, true, false);
permanent.damage(2, source.getSourceId(), game, false, true);
} else {
permanent.destroy(source.getId(), game, false);
}

View file

@ -98,10 +98,10 @@ class AlphaBrawlEffect extends OneShotEffect {
if (player != null) {
int power = creature.getPower().getValue();
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
perm.damage(power, creature.getId(), game, true, false);
perm.damage(power, creature.getId(), game, false, true);
}
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
creature.damage(perm.getPower().getValue(), perm.getId(), game, true, false);
creature.damage(perm.getPower().getValue(), perm.getId(), game, false, true);
}
return true;
}

View file

@ -144,7 +144,7 @@ class FlayerEffect extends OneShotEffect {
UUID target = source.getTargets().getFirstTarget();
Permanent targetCreature = game.getPermanent(target);
if (targetCreature != null) {
targetCreature.damage(amount, creature.getId(), game, true, false);
targetCreature.damage(amount, creature.getId(), game, false, true);
return true;
}
Player player = game.getPlayer(target);

View file

@ -198,7 +198,7 @@ class RavagerOfTheFellsEffect extends OneShotEffect {
}
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (creature != null) {
creature.damage(2, source.getSourceId(), game, true, false);
creature.damage(2, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -85,7 +85,7 @@ class WrackWithMadnessEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, true, false);
permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true);
return true;
}
return false;

View file

@ -103,7 +103,7 @@ class BlastOfGeniusEffect extends OneShotEffect {
int damage = card.getManaCost().convertedManaCost();
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (creature != null) {
creature.damage(damage, source.getSourceId(), game, true, false);
creature.damage(damage, source.getSourceId(), game, false, true);
return true;
}
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));

View file

@ -148,7 +148,7 @@ class BloodEffect extends OneShotEffect {
Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (sourcePermanent != null && targetCreature != null) {
targetCreature.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, true, false);
targetCreature.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true);
return true;
}
Player targetPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget());

View file

@ -99,7 +99,7 @@ class MorgueBurstEffect extends OneShotEffect {
int damage = card.getPower().getValue();
Permanent creature = game.getPermanent(source.getTargets().get(1).getTargets().get(0));
if (creature != null) {
creature.damage(damage, source.getSourceId(), game, true, false);
creature.damage(damage, source.getSourceId(), game, false, true);
return true;
}
Player targetPlayer = game.getPlayer(source.getTargets().get(1).getTargets().get(0));

View file

@ -108,8 +108,8 @@ class ScabClanGiantEffect extends OneShotEffect {
// 20110930 - 701.10
if (creature1 != null && creature2 != null) {
if (creature1.getCardType().contains(CardType.CREATURE) && creature2.getCardType().contains(CardType.CREATURE)) {
creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, true, false);
creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, true, false);
creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, false, true);
creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true);
return true;
}
}

View file

@ -135,7 +135,7 @@ class IbHalfheartGoblinTacticianEffect extends OneShotEffect {
for (UUID blockerId : blockingCreatures) {
Permanent blockingCreature = game.getPermanent(blockerId);
if (blockingCreature != null) {
blockingCreature.damage(4, blockedCreature.getId(), game, true, false);
blockingCreature.damage(4, blockedCreature.getId(), game, false, true);
}
}
return true;

View file

@ -117,7 +117,7 @@ class FieryBombardmentEffect extends OneShotEffect {
} else {
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (creature != null) {
creature.damage(damage, source.getSourceId(), game, true, false);
creature.damage(damage, source.getSourceId(), game, false, true);
}
}
}

View file

@ -137,7 +137,7 @@ class HatchetBullyEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(2, source.getSourceId(), game, true, false);
permanent.damage(2, source.getSourceId(), game, false, true);
}
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {

View file

@ -111,7 +111,7 @@ class BorosReckonerDealDamageEffect extends OneShotEffect {
}
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
if (creature != null) {
creature.damage(amount, source.getSourceId(), game, true, false);
creature.damage(amount, source.getSourceId(), game, false, true);
return true;
}
}

View file

@ -144,8 +144,8 @@ class GruulRagebeastEffect extends OneShotEffect {
&& target != null
&& triggeredCreature.getCardType().contains(CardType.CREATURE)
&& target.getCardType().contains(CardType.CREATURE)) {
triggeredCreature.damage(target.getPower().getValue(), target.getId(), game, true, false);
target.damage(triggeredCreature.getPower().getValue(), triggeredCreature.getId(), game, true, false);
triggeredCreature.damage(target.getPower().getValue(), target.getId(), game, false, true);
target.damage(triggeredCreature.getPower().getValue(), triggeredCreature.getId(), game, false, true);
return true;
}
return false;

View file

@ -92,7 +92,7 @@ class HomingLightningEffect extends OneShotEffect {
if (target != null) {
for (Permanent creature : creatures) {
if (creature != null) {
creature.damage(4, id, game, true, false);
creature.damage(4, id, game, false, true);
}
}
return true;

View file

@ -99,7 +99,7 @@ class KjeldoranRoyalGuardEffect extends ReplacementEffectImpl {
DamagePlayerEvent damageEvent = (DamagePlayerEvent) event;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage());
p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
return true;
}
return true;

View file

@ -91,7 +91,7 @@ class BalefireDragonEffect extends OneShotEffect {
int amount = (Integer)getValue("damage");
if (amount > 0) {
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
creature.damage(amount, source.getSourceId(), game, true, false);
creature.damage(amount, source.getSourceId(), game, false, true);
}
}
return true;

View file

@ -95,7 +95,7 @@ class BlasphemousActEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
for (Permanent permanent : permanents) {
permanent.damage(13, source.getId(), game, true, false);
permanent.damage(13, source.getId(), game, false, true);
}
return true;
}

View file

@ -88,7 +88,7 @@ class BrimstoneVolleyEffect extends OneShotEffect {
}
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.damage(damage, source.getSourceId(), game, true, false);
permanent.damage(damage, source.getSourceId(), game, false, true);
return true;
}
Player player = game.getPlayer(targetPointer.getFirst(game, source));

View file

@ -104,7 +104,7 @@ class CorpseLungeEffect extends OneShotEffect {
if (amount > 0) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, true, false);
permanent.damage(amount, source.getSourceId(), game, false, true);
return true;
}
}

View file

@ -139,11 +139,11 @@ class GarrukRelentlessDamageEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
int damage = permanent.getPower().getValue();
permanent.damage(3, source.getSourceId(), game, true, false);
permanent.damage(3, source.getSourceId(), game, false, true);
if (damage > 0) {
Permanent garruk = game.getPermanent(source.getSourceId());
if (garruk != null) {
garruk.damage(damage, permanent.getId(), game, true, false);
garruk.damage(damage, permanent.getId(), game, false, true);
}
}
return true;

View file

@ -98,7 +98,7 @@ class HereticsPunishmentEffect extends OneShotEffect {
}
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.damage(maxCost, source.getSourceId(), game, true, false);
permanent.damage(maxCost, source.getSourceId(), game, false, true);
return true;
}
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));

View file

@ -89,7 +89,7 @@ class IntoTheMawOfHellEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (permanent != null) {
permanent.damage(13, source.getSourceId(), game, true, false);
permanent.damage(13, source.getSourceId(), game, false, true);
return true;
}
return false;

View file

@ -112,8 +112,8 @@ class NightfallPredatorEffect extends OneShotEffect {
// 20110930 - 701.10
if (creature1 != null && creature2 != null) {
if (creature1.getCardType().contains(CardType.CREATURE) && creature2.getCardType().contains(CardType.CREATURE)) {
creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, true, false);
creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, true, false);
creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, false, true);
creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true);
return true;
}
}

View file

@ -120,7 +120,7 @@ class DictateOfTheTwinGodsEffect extends ReplacementEffectImpl {
} else {
Permanent targetPermanent = game.getPermanent(event.getTargetId());
if (targetPermanent != null) {
targetPermanent.damage(damageEvent.getAmount()*2, damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage(), event.getAppliedEffects());
targetPermanent.damage(damageEvent.getAmount()*2, damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
return true;
}
}

View file

@ -99,7 +99,7 @@ class RiddleOfLightningEffect extends OneShotEffect {
controller.revealCards(sourceCard.getName(), new CardsImpl(card), game);
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (targetCreature != null) {
targetCreature.damage(card.getManaCost().convertedManaCost(), source.getSourceId(), game, true, false);
targetCreature.damage(card.getManaCost().convertedManaCost(), source.getSourceId(), game, false, true);
return true;
}
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));

View file

@ -88,7 +88,7 @@ class StarfallEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
permanent.damage(3, source.getSourceId(), game, true, false);
permanent.damage(3, source.getSourceId(), game, false, true);
if (permanent.getCardType().contains(CardType.ENCHANTMENT)) {
Player targetController = game.getPlayer(permanent.getControllerId());
if (targetController != null) {

View file

@ -89,7 +89,7 @@ class ConeOfFlameEffect extends OneShotEffect {
for (UUID targetId : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
applied |= (permanent.damage(damage, source.getSourceId(), game, true, false) > 0);
applied |= (permanent.damage(damage, source.getSourceId(), game, false, true) > 0);
}
Player player = game.getPlayer(targetId);
if (player != null) {

View file

@ -99,7 +99,7 @@ class ChainLightningEffect extends OneShotEffect {
else {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.damage(3, source.getSourceId(), game, true, false);
permanent.damage(3, source.getSourceId(), game, false, true);
affectedPlayer = game.getPlayer(permanent.getControllerId());
}
}

View file

@ -104,7 +104,7 @@ class DrainLifeEffect extends OneShotEffect {
if (permanent.getToughness().getValue() < amount) {
lifetogain = permanent.getToughness().getValue();
}
permanent.damage(amount, source.getSourceId(), game, true, false);
permanent.damage(amount, source.getSourceId(), game, false, true);
} else {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {

View file

@ -98,7 +98,7 @@ class ConsumeSpiritEffect extends OneShotEffect {
if (amount > 0) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, true, false);
permanent.damage(amount, source.getSourceId(), game, false, true);
} else {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {

View file

@ -92,7 +92,7 @@ class EarthquakeEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
int amount = source.getManaCostsToPay().getX();
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
permanent.damage(amount, source.getId(), game, true, false);
permanent.damage(amount, source.getId(), game, false, true);
}
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
Player player = game.getPlayer(playerId);

View file

@ -98,7 +98,7 @@ class FireballEffect extends OneShotEffect {
for (UUID targetId: targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.damage(damagePer, source.getSourceId(), game, true, false);
permanent.damage(damagePer, source.getSourceId(), game, false, true);
}
else {
Player player = game.getPlayer(targetId);

View file

@ -102,7 +102,7 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl {
if (permanent != null) {
game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + permanent.getName() + " instead");
// keep the original source id as it is redirecting
permanent.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, true, false);
permanent.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true);
}
Player player = game.getPlayer(redirectTo);
if (player != null) {

View file

@ -118,7 +118,7 @@ class MasterOfTheWildHuntEffect extends OneShotEffect {
if (target != null && game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0) {
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
permanent.tap(game);
target.damage(permanent.getToughness().getValue(), permanent.getId(), game, true, false);
target.damage(permanent.getToughness().getValue(), permanent.getId(), game, false, true);
wolves.add(permanent.getId());
}
Player player = game.getPlayer(target.getControllerId());

View file

@ -82,7 +82,7 @@ class ChandrasOutrageEffect extends OneShotEffect {
if (permanent != null) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
permanent.damage(4, source.getSourceId(), game, true, false);
permanent.damage(4, source.getSourceId(), game, false, true);
player.damage(2, source.getSourceId(), game, false, true);
return true;
}

View file

@ -94,7 +94,7 @@ class CorruptEffect extends OneShotEffect {
int damageDealt = amount;
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
damageDealt = permanent.damage(amount, source.getSourceId(), game, true, false);
damageDealt = permanent.damage(amount, source.getSourceId(), game, false, true);
}
else {
Player player = game.getPlayer(source.getFirstTarget());

View file

@ -98,8 +98,8 @@ class CyclopsGladiatorEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(target.getFirstTarget());
Permanent cyclops = game.getPermanent(source.getSourceId());
if (permanent != null && cyclops != null) {
permanent.damage(cyclops.getPower().getValue(), cyclops.getId(), game, true, false);
cyclops.damage(permanent.getPower().getValue(), permanent.getId(), game, true, false);
permanent.damage(cyclops.getPower().getValue(), cyclops.getId(), game, false, true);
cyclops.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true);
return true;
}
}

View file

@ -91,7 +91,7 @@ class FlingEffect extends OneShotEffect {
if (amount > 0) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, true, false);
permanent.damage(amount, source.getSourceId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());

View file

@ -94,7 +94,7 @@ class GoblinBangchuckersEffect extends OneShotEffect {
if (controller.flipCoin(game)) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.damage(2, source.getSourceId(), game, true, false);
permanent.damage(2, source.getSourceId(), game, false, true);
return true;
}
Player player = game.getPlayer(targetPointer.getFirst(game, source));
@ -105,7 +105,7 @@ class GoblinBangchuckersEffect extends OneShotEffect {
} else {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.damage(2, source.getSourceId(), game, true, false);
permanent.damage(2, source.getSourceId(), game, false, true);
return true;
}
}

View file

@ -134,7 +134,7 @@ class WarstormSurgeEffect extends OneShotEffect {
UUID target = source.getTargets().getFirstTarget();
Permanent targetCreature = game.getPermanent(target);
if (targetCreature != null) {
targetCreature.damage(amount, creature.getId(), game, true, false);
targetCreature.damage(amount, creature.getId(), game, false, true);
return true;
}
Player player = game.getPlayer(target);

View file

@ -130,7 +130,7 @@ class ChandraPyromasterEffect1 extends OneShotEffect {
}
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (creature != null) {
creature.damage(1, source.getSourceId(), game, true, false);
creature.damage(1, source.getSourceId(), game, false, true);
ContinuousEffect effect = new CantBlockTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId()));
game.addEffect(effect, source);

View file

@ -111,7 +111,7 @@ class GoblinKaboomistFlipCoinEffect extends OneShotEffect {
if (!player.flipCoin(game)) {
String message = new StringBuilder(permanent.getLogName()).append(" deals 2 damage to itself").toString();
game.informPlayers(message);
permanent.damage(2, source.getSourceId(), game, true, false);
permanent.damage(2, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -156,7 +156,7 @@ class SiegeDragonDamageEffect extends OneShotEffect {
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
for (Permanent permanent : permanents) {
permanent.damage(2, source.getSourceId(), game, true, false);
permanent.damage(2, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -117,7 +117,7 @@ class SoulOfShandalarEffect extends OneShotEffect {
}
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (creature != null) {
creature.damage(3, source.getSourceId(), game, true, false);
creature.damage(3, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -97,7 +97,7 @@ class AbyssalHunterEffect extends OneShotEffect {
if (targetCreature != null) {
targetCreature.tap(game);
if (hunter != null) {
targetCreature.damage(hunter.getPower().getValue(), hunter.getId(), game, true, false);
targetCreature.damage(hunter.getPower().getValue(), hunter.getId(), game, false, true);
}
return true;
}

View file

@ -104,7 +104,7 @@ class FieryGambitEffect extends OneShotEffect {
if (controllerStopped) {
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (creature != null) {
creature.damage(3, source.getSourceId(), game, true, false);
creature.damage(3, source.getSourceId(), game, false, true);
}
if (flipsWon > 1) {
new DamagePlayersEffect(6, TargetController.OPPONENT).apply(game, source);

View file

@ -125,7 +125,7 @@ class GoblinCharbelcherEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.damage(damage, source.getSourceId(), game, true, false);
permanent.damage(damage, source.getSourceId(), game, false, true);
}
else{
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));

View file

@ -99,7 +99,7 @@ class SpikeshotGoblinEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(damage, sourcePermanent.getId(), game, true, false);
permanent.damage(damage, sourcePermanent.getId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());

View file

@ -85,7 +85,7 @@ class BurntheImpureEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
permanent.damage(3, source.getSourceId(), game, true, false);
permanent.damage(3, source.getSourceId(), game, false, true);
if (permanent.getAbilities().contains(InfectAbility.getInstance())) {
Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null) {

View file

@ -107,7 +107,7 @@ class CrushUnderfootEffect extends OneShotEffect {
game.informPlayers(new StringBuilder("Crush Underfoot: Choosen Giant is").append(giant.getName()).toString());
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (targetCreature != null) {
targetCreature.damage(giant.getPower().getValue(), source.getSourceId(), game, true, false);
targetCreature.damage(giant.getPower().getValue(), source.getSourceId(), game, false, true);
return true;
}
}

View file

@ -138,7 +138,7 @@ class MoltenDisasterEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
int amount = source.getManaCostsToPay().getX();
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
permanent.damage(amount, source.getId(), game, true, false);
permanent.damage(amount, source.getId(), game, false, true);
}
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
Player player = game.getPlayer(playerId);

View file

@ -113,7 +113,7 @@ class OraclesAttendantsReplacementEffect extends ReplacementEffectImpl {
Permanent permanent = game.getPermanent(source.getSourceId());
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
if (permanent != null) {
permanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage());
permanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
return true;
}
return false;

View file

@ -127,7 +127,7 @@ class CathedralMembraneEffect extends OneShotEffect {
for (UUID uuid : watcher.blockedCreatures) {
Permanent permanent = game.getPermanent(uuid);
if (permanent != null) {
permanent.damage(6, source.getSourceId(), game, true, false);
permanent.damage(6, source.getSourceId(), game, false, true);
}
}
}

View file

@ -92,7 +92,7 @@ class BlazingSalvoEffect extends OneShotEffect {
if (player.chooseUse(Outcome.Damage, message, game)){
player.damage(5, source.getSourceId(), game, true, false);
} else {
permanent.damage(3, source.getSourceId(), game, true, false);
permanent.damage(3, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -93,7 +93,7 @@ class WhipkeeperEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature != null) {
creature.damage(creature.getDamage(), source.getSourceId(), game, true, false);
creature.damage(creature.getDamage(), source.getSourceId(), game, false, true);
return true;
}
return false;

View file

@ -114,7 +114,7 @@ class BoshIronGolemEffect extends OneShotEffect {
if (amount > 0) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, true, false);
permanent.damage(amount, source.getSourceId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());

View file

@ -144,7 +144,7 @@ class RaziaBorosArchangelEffect extends PreventionEffectImpl {
if (permanent != null) {
game.informPlayers("Dealing " + prevented + " to " + permanent.getName() + " instead");
// keep the original source id as it is redirecting
permanent.damage(prevented, event.getSourceId(), game, true, false);
permanent.damage(prevented, event.getSourceId(), game, false, true);
}
}
}

View file

@ -120,7 +120,7 @@ class LastStandEffect extends OneShotEffect {
if (creature != null) {
int mountains = game.getBattlefield().count(filterMountain, source.getSourceId(), source.getControllerId(), game);
if (mountains > 0) {
creature.damage(mountains, source.getSourceId(), game, true, false);
creature.damage(mountains, source.getSourceId(), game, false, true);
}
}
// Put a 1/1 green Saproling creature token onto the battlefield for each Forest you control.

View file

@ -119,8 +119,8 @@ class RivalsDuelFightTargetsEffect extends OneShotEffect {
// 20110930 - 701.10
if (creature1 != null && creature2 != null) {
if (creature1.getCardType().contains(CardType.CREATURE) && creature2.getCardType().contains(CardType.CREATURE)) {
creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, true, false);
creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, true, false);
creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, false, true);
creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true);
return true;
}
}

View file

@ -148,8 +148,8 @@ class GuildFeudEffect extends OneShotEffect {
// If two creatures are put onto the battlefield this way, those creatures fight each other
if (opponentCreature != null && controllerCreature != null) {
int power = opponentCreature.getPower().getValue();
opponentCreature.damage(controllerCreature.getPower().getValue(), source.getSourceId(), game, true, false);
controllerCreature.damage(power, source.getSourceId(), game, true, false);
opponentCreature.damage(controllerCreature.getPower().getValue(), source.getSourceId(), game, false, true);
controllerCreature.damage(power, source.getSourceId(), game, false, true);
}
}
return false;

View file

@ -110,7 +110,7 @@ class IzzetStaticasterDamageEffect extends OneShotEffect {
filter.add(new NamePredicate(targetPermanent.getName()));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getId(), game);
for (Permanent permanent : permanents) {
permanent.damage(1, source.getSourceId(), game, true, false);
permanent.damage(1, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -148,7 +148,7 @@ class PalisadeGiantReplacementEffect extends ReplacementEffectImpl {
}
game.informPlayers(message.toString());
// redirect damage
sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage(), event.getAppliedEffects());
sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
return true;
}
return false;

View file

@ -188,7 +188,7 @@ class VolatileRigEffect2 extends OneShotEffect {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
for (Permanent permanent: permanents) {
permanent.damage(4, source.getId(), game, true, false);
permanent.damage(4, source.getId(), game, false, true);
}
for (UUID playerId: player.getInRange()) {
Player damageToPlayer = game.getPlayer(playerId);

View file

@ -110,7 +110,7 @@ class ExplosiveRevelationEffect extends OneShotEffect {
for (UUID targetId: targetPointer.getTargets(game, source)) {
Permanent targetedCreature = game.getPermanent(targetId);
if (targetedCreature != null) {
targetedCreature.damage(damage, source.getSourceId(), game, true, false);
targetedCreature.damage(damage, source.getSourceId(), game, false, true);
}
else {
Player targetedPlayer = game.getPlayer(targetId);

View file

@ -88,7 +88,7 @@ class ForkedBoltEffect extends OneShotEffect {
for (UUID targetId: targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.damage(damagePer, source.getSourceId(), game, true, false);
permanent.damage(damagePer, source.getSourceId(), game, false, true);
}
else {
Player player = game.getPlayer(targetId);

View file

@ -113,7 +113,7 @@ class LordOfShatterskullPassEffect extends OneShotEffect {
filter.add(new ControllerIdPredicate(defenderId));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
for (Permanent permanent : permanents) {
permanent.damage(6, source.getSourceId(), game, true, false);
permanent.damage(6, source.getSourceId(), game, false, true);
}
return true;
}

View file

@ -88,7 +88,7 @@ class PestilenceDemonEffect extends OneShotEffect {
for (UUID permanentId : game.getBattlefield().getAllPermanentIds()) {
Permanent p = game.getPermanent(permanentId);
if (p != null && p.getCardType().contains(CardType.CREATURE)) {
p.damage(1, source.getSourceId(), game, true, false);
p.damage(1, source.getSourceId(), game, false, true);
}
}
for (UUID playerId : game.getPlayerList()) {

View file

@ -103,7 +103,7 @@ class SphinxBoneWandEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, true, false);
permanent.damage(amount, source.getSourceId(), game, false, true);
}
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {

View file

@ -101,7 +101,7 @@ class UndyingFlamesEffect extends OneShotEffect {
if (damage > 0) {
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (creature != null) {
creature.damage(damage, source.getSourceId(), game, true, false);
creature.damage(damage, source.getSourceId(), game, false, true);
game.informPlayers(new StringBuilder(sourceCard.getName()).append(" deals ").append(damage).append(" damage to ").append(creature.getName()).toString());
applied = true;
break;

View file

@ -103,11 +103,11 @@ class ArcTrailEffect extends OneShotEffect {
}
if (permanent != null) {
applied |= (permanent.damage( damage, source.getSourceId(), game, true, false ) > 0);
applied |= (permanent.damage( damage, source.getSourceId(), game, false, true ) > 0);
}
Player player = game.getPlayer(target);
if (player != null) {
applied |= (player.damage( damage, source.getSourceId(), game, true, false ) > 0);
applied |= (player.damage( damage, source.getSourceId(), game, false, true ) > 0);
}
twoDamageDone = true;

View file

@ -98,7 +98,7 @@ class CerebralEruptionEffect1 extends OneShotEffect {
int damage = card.getManaCost().convertedManaCost();
player.damage(damage, source.getId(), game, false, true);
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
perm.damage(damage, source.getId(), game, true, false);
perm.damage(damage, source.getId(), game, false, true);
}
return true;
}

View file

@ -100,7 +100,7 @@ class EmbersmithEffect extends OneShotEffect {
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(1, source.getId(), game, true, false);
permanent.damage(1, source.getId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());

View file

@ -98,7 +98,7 @@ class SpikeshotElderEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(damage, sourcePermanent.getId(), game, true, false);
permanent.damage(damage, sourcePermanent.getId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());

View file

@ -96,7 +96,7 @@ class WingPunctureEffect extends OneShotEffect {
Permanent targetPermanent = (Permanent) game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (sourcePermanent != null && targetPermanent != null) {
targetPermanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, true, false);
targetPermanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true);
return true;
}
return false;

View file

@ -107,7 +107,7 @@ class EmberGaleEffect extends OneShotEffect {
new ColorPredicate(ObjectColor.BLUE)));
filter2.add(new CardTypePredicate(CardType.CREATURE));
for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter2, targetPlayer.getId(), game)) {
creature.damage(1, source.getSourceId(), game, true, false);
creature.damage(1, source.getSourceId(), game, false, true);
}
return true;
}

Some files were not shown because too many files have changed in this diff Show more