mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 05:52:06 -08:00
[KHM] Implemented Varragoth, Bloodsky Sire (#7341)
* [KHM] Implemented Boast mechanic * BoastAbility - Added author tag * [KHM] Implemented Varragoth, Bloodsky Sire * [KHM] Fixup BoastAbility and added BoastHint * [KHM] BoastAbility - Call super instead of copying code
This commit is contained in:
parent
9f47369957
commit
0f4d90b871
5 changed files with 190 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.keyword.BoastAbility;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public enum BoastCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
|
||||
if (source instanceof BoastAbility && creature != null && watcher != null) {
|
||||
BoastAbility ability = (BoastAbility) source;
|
||||
return ability.hasMoreActivationsThisTurn(game) &&
|
||||
watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(creature, game));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
28
Mage/src/main/java/mage/abilities/hint/common/BoastHint.java
Normal file
28
Mage/src/main/java/mage/abilities/hint/common/BoastHint.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package mage.abilities.hint.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.BoastCondition;
|
||||
import mage.abilities.hint.ConditionHint;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public enum BoastHint implements Hint {
|
||||
instance;
|
||||
private static final ConditionHint hint = new ConditionHint(BoastCondition.instance,
|
||||
"Can activate Boast ability", null,
|
||||
"Can't activate Boast ability", null, true);
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
return hint.getText(game, ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hint copy() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
45
Mage/src/main/java/mage/abilities/keyword/BoastAbility.java
Normal file
45
Mage/src/main/java/mage/abilities/keyword/BoastAbility.java
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.condition.common.BoastCondition;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.common.BoastHint;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public class BoastAbility extends ActivatedAbilityImpl {
|
||||
|
||||
public BoastAbility(Effect effect, ManaCosts cost) {
|
||||
super(Zone.BATTLEFIELD, effect, cost);
|
||||
this.maxActivationsPerTurn = 1;
|
||||
this.addWatcher(new AttackedThisTurnWatcher());
|
||||
this.condition = BoastCondition.instance;
|
||||
this.addHint(BoastHint.instance);
|
||||
}
|
||||
|
||||
public BoastAbility(BoastAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoastAbility copy() {
|
||||
return new BoastAbility(this);
|
||||
}
|
||||
|
||||
// Needed to make this public for BoastHint to work correctly (called by BoastCondition)
|
||||
@Override
|
||||
public boolean hasMoreActivationsThisTurn(Game game) {
|
||||
return super.hasMoreActivationsThisTurn(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Boast — " + super.getRule() + " <i>(Activate this ability only if this creature attacked this turn and only once each turn.)</i>";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue