foul-magics/Mage/src/main/java/mage/abilities/keyword/BushidoAbility.java
xenohedron 4273d3b5ba
refactor: remove unnecessary "lockedIn" parameter (#11244)
* remove lockedIn from logic: BoostControlledEffect

* remove lockedIn field: BoostControlledEffect

* remove constructor parameter: BoostControlledEffect

* simplify BoostEnchantedEffect

* apply fix to BoostSourceEffect

* remove unused param

* refactor SetBasePowerToughnessAllEffect

* additional cleanup
2023-10-01 22:50:44 -04:00

57 lines
1.7 KiB
Java

package mage.abilities.keyword;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBlockedSourceTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.Duration;
import mage.game.Game;
/**
* @author awjackson
*/
public class BushidoAbility extends BlocksOrBlockedSourceTriggeredAbility {
private final DynamicValue value;
private final String rule;
public BushidoAbility(int value) {
this(StaticValue.get(value));
}
public BushidoAbility(DynamicValue value) {
super(new BoostSourceEffect(value, value, Duration.EndOfTurn));
this.value = value;
rule = (
value instanceof StaticValue ?
"Bushido " + value.toString() :
"{this} has bushido X, where X is " + value.getMessage()
) + getReminder(value.toString());
}
static String getReminder(String xValue) {
return " <i>(Whenever this creature blocks or becomes blocked, it gets +" + xValue + "/+" + xValue + " until end of turn.)</i>";
}
protected BushidoAbility(final BushidoAbility ability) {
super(ability);
this.value = ability.value;
this.rule = ability.rule;
}
@Override
public BushidoAbility copy() {
return new BushidoAbility(this);
}
public int getValue(Ability source, Game game, Effect effect) {
return value.calculate(game, source, effect);
}
@Override
public String getRule() {
return rule;
}
}