mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* Fixed bug with P/T boost triggered by blocking creatures not lasting until end of turn (e.g. Rabid Elephant).
This commit is contained in:
parent
60936a672c
commit
4bf8226a43
10 changed files with 31 additions and 31 deletions
|
|
@ -35,22 +35,21 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
|||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
|
||||
public class RampageAbility extends BecomesBlockedTriggeredAbility {
|
||||
|
||||
private final String rule;
|
||||
|
||||
public RampageAbility(int amount) {
|
||||
super(null, false);
|
||||
rule = "rampage " + amount;
|
||||
rule = "rampage " + amount + "(Whenever this creature becomes blocked, it gets +"
|
||||
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)";
|
||||
RampageValue rv = new RampageValue(amount);
|
||||
this.addEffect(new BoostSourceEffect(rv, rv, Duration.EndOfTurn));
|
||||
this.addEffect(new BoostSourceEffect(rv, rv, Duration.EndOfTurn, true));
|
||||
}
|
||||
|
||||
public RampageAbility(final RampageAbility ability) {
|
||||
|
|
@ -69,7 +68,6 @@ public class RampageAbility extends BecomesBlockedTriggeredAbility {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class RampageValue implements DynamicValue {
|
||||
|
||||
private final int amount;
|
||||
|
|
@ -89,11 +87,10 @@ class RampageValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
return blockers > 1 ? (blockers - 1) * amount : 0;
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
return blockers > 1 ? (blockers - 1) * amount : 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -101,6 +98,7 @@ class RampageValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Rampage " + amount;
|
||||
return "rampage " + amount + "(Whenever this creature becomes blocked, it gets +"
|
||||
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue