mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 06:22:01 -08:00
[40K] Implemented Gargoyle Flock
This commit is contained in:
parent
8094032665
commit
e9684c86ac
6 changed files with 163 additions and 40 deletions
|
|
@ -0,0 +1,23 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.CreatureEnteredControllerWatcher;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum CreatureEnteredUnderYourControlCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return CreatureEnteredControllerWatcher.enteredCreatureForPlayer(source.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "a creature entered the battlefield under your control this turn";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TyranidGargoyleToken extends TokenImpl {
|
||||
|
||||
public TyranidGargoyleToken() {
|
||||
super("Tyranid Gargoyle Token", "1/1 blue Tyranid creature token with flying");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setBlue(true);
|
||||
subtype.add(SubType.TYRANID);
|
||||
subtype.add(SubType.GARGOYLE);
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
|
||||
addAbility(FlyingAbility.getInstance());
|
||||
|
||||
availableImageSetCodes.addAll(Arrays.asList("40K"));
|
||||
}
|
||||
|
||||
public TyranidGargoyleToken(final TyranidGargoyleToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TyranidGargoyleToken copy() {
|
||||
return new TyranidGargoyleToken(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class CreatureEnteredControllerWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> players = new HashSet<>();
|
||||
|
||||
public CreatureEnteredControllerWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getTarget().isCreature(game)) {
|
||||
players.add(zEvent.getTarget().getControllerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
players.clear();
|
||||
}
|
||||
|
||||
public static boolean enteredCreatureForPlayer(UUID playerId, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(CreatureEnteredControllerWatcher.class)
|
||||
.players
|
||||
.contains(playerId);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue