[EOE] Implement Tapestry Warden

This commit is contained in:
theelk801 2025-07-13 17:05:54 -04:00
parent ff17fb1125
commit ce35717f1f
5 changed files with 152 additions and 11 deletions

View file

@ -1,7 +1,5 @@
package mage.abilities.keyword;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapTargetCost;
@ -11,10 +9,10 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.List;
import java.util.Optional;
/**
* @author TheElk801
@ -61,14 +59,21 @@ class StationAbilityEffect extends OneShotEffect {
if (permanent == null) {
return false;
}
int power = Optional
.ofNullable((List<Permanent>) getValue("tappedPermanents"))
.map(permanents -> permanents
.stream()
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.sum())
.orElse(0);
List<Permanent> creatures = (List<Permanent>) getValue("tappedPermanents");
if (creatures == null) {
return false;
}
int power = 0;
for (Permanent creature : creatures) {
GameEvent event = GameEvent.getEvent(
GameEvent.EventType.STATION_PERMANENT, creature.getId(),
source, source.getControllerId(), creature.getPower().getValue()
);
if (game.replaceEvent(event)) {
continue;
}
power += event.getAmount();
}
return power > 0 && permanent.addCounters(CounterType.CHARGE.createInstance(power), source, game);
}
}

View file

@ -228,6 +228,13 @@ public class GameEvent implements Serializable {
sourceId sourceId of the mount
playerId the id of the controlling player
*/
STATION_PERMANENT,
/* STATION_PERMANENT
targetId the id of the creature stationing
sourceId sourceId of the spaceship or planet
playerId the id of the controlling player
amount how many counters are being added
*/
CAST_SPELL,
CAST_SPELL_LATE,
/* SPELL_CAST, CAST_SPELL_LATE