implement [MH3] Arena of Glory and usage of ManaSpentDelayedTriggeredAbility (#12404)

This commit is contained in:
Susucre 2024-06-07 18:34:45 +02:00 committed by GitHub
parent 0cd2fda764
commit 3e18b58cac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 200 additions and 3 deletions

View file

@ -103,9 +103,10 @@ public class MageObjectReference implements Comparable<MageObjectReference>, Ser
}
@Override
public String toString(){
return "("+zoneChangeCounter+"|"+sourceId.toString().substring(0,3)+")";
public String toString() {
return "(" + zoneChangeCounter + "|" + sourceId.toString().substring(0, 3) + ")";
}
public UUID getSourceId() {
return sourceId;
}
@ -185,6 +186,14 @@ public class MageObjectReference implements Comparable<MageObjectReference>, Ser
return null;
}
public Spell getSpell(Game game) {
Spell spell = game.getSpell(sourceId);
if (spell != null && spell.getZoneChangeCounter(game) == zoneChangeCounter) {
return spell;
}
return null;
}
public boolean zoneCounterIsCurrent(Game game) {
return game.getState().getZoneChangeCounter(sourceId) == zoneChangeCounter;
}

View file

@ -27,7 +27,7 @@ public class ManaSpentDelayedTriggeredAbility extends DelayedTriggeredAbility {
setTriggerPhrase("When you spend this mana to cast " + filter.getMessage() + ", ");
}
private ManaSpentDelayedTriggeredAbility(final ManaSpentDelayedTriggeredAbility ability) {
protected ManaSpentDelayedTriggeredAbility(final ManaSpentDelayedTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
}

View file

@ -36,6 +36,7 @@ public class AddContinuousEffectToGame extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
for (Effect effect : this.effects) {
effect.setTargetPointer(this.getTargetPointer().copy());
game.addEffect((ContinuousEffect) effect, source);
}
return true;