add Star Wars expansion sets to the Star Wars set

This commit is contained in:
ninthworld 2018-07-16 20:55:05 -07:00
parent 1592a9d173
commit f31bfa829e
72 changed files with 4574 additions and 1 deletions

View file

@ -64,6 +64,7 @@ public enum SubType {
AZRA("Azra", SubTypeSet.CreatureType),
// B
BADGER("Badger", SubTypeSet.CreatureType),
BARABEL("Barabel", SubTypeSet.CreatureType, true), // Star Wars
BARBARIAN("Barbarian", SubTypeSet.CreatureType),
BASILISK("Basilisk", SubTypeSet.CreatureType),
BAT("Bat", SubTypeSet.CreatureType),
@ -99,6 +100,7 @@ public enum SubType {
COWARD("Coward", SubTypeSet.CreatureType),
CRAB("Crab", SubTypeSet.CreatureType),
CROCODILE("Crocodile", SubTypeSet.CreatureType),
CROLUTE("Crolute", SubTypeSet.CreatureType, true), // Star Wars
CYBORG("Cyborg", SubTypeSet.CreatureType, true), // Star Wars
CYCLOPS("Cyclops", SubTypeSet.CreatureType),
// D
@ -204,6 +206,7 @@ public enum SubType {
LICID("Licid", SubTypeSet.CreatureType),
LIZARD("Lizard", SubTypeSet.CreatureType),
LOBSTER("Lobster", SubTypeSet.CreatureType, true), // Unglued
LUKE("Luke", SubTypeSet.PlaneswalkerType, true), // Star Wars
// M
MANTELLIAN("Mantellian", SubTypeSet.CreatureType, true), // Star Wars
MANTICORE("Manticore", SubTypeSet.CreatureType),
@ -312,6 +315,7 @@ public enum SubType {
SPONGE("Sponge", SubTypeSet.CreatureType),
SQUID("Squid", SubTypeSet.CreatureType),
SQUIRREL("Squirrel", SubTypeSet.CreatureType),
SNOKE("Snoke", SubTypeSet.PlaneswalkerType, true), // Star Wars
STARFISH("Starfish", SubTypeSet.CreatureType),
STARSHIP("Starship", SubTypeSet.CreatureType, true), // Star Wars
SULLUSTAN("Sullustan", SubTypeSet.CreatureType, true), // Star Wars

View file

@ -1022,6 +1022,7 @@ public abstract class GameImpl implements Game, Serializable {
watchers.add(new CastSpellLastTurnWatcher());
watchers.add(new CastSpellYourLastTurnWatcher());
watchers.add(new PlayerLostLifeWatcher());
watchers.add(new PlayerLostLifeNonCombatWatcher());
watchers.add(new BlockedAttackerWatcher());
watchers.add(new DamageDoneWatcher());
watchers.add(new PlanarRollWatcher());

View file

@ -0,0 +1,61 @@
package mage.game.command.emblems;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.PreventAllDamageByAllPermanentsEffect;
import mage.abilities.effects.common.PreventAllDamageToPlayersEffect;
import mage.constants.*;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
import mage.game.permanent.token.CatToken2;
import mage.game.turn.Phase;
import mage.players.Player;
/**
*
* @author NinthWorld
*/
public class LukeSkywalkerEmblem extends Emblem {
// -6: You get an emblem with "Prevent all damage that would be dealt to you during combat." Exile Luke Skywalker, the Last Jedi.
public LukeSkywalkerEmblem() {
this.setName("Emblem Luke Skywalker");
this.setExpansionSetCodeForImage("SWS");
this.getAbilities().add(new SimpleStaticAbility(Zone.BATTLEFIELD, new LukeSkywalkerEmblemEffect()));
}
}
class LukeSkywalkerEmblemEffect extends PreventionEffectImpl {
public LukeSkywalkerEmblemEffect() {
super(Duration.Custom, Integer.MAX_VALUE, false);
staticText = "Prevent all damage that would be dealt to you during combat";
}
public LukeSkywalkerEmblemEffect(final LukeSkywalkerEmblemEffect effect) {
super(effect);
}
@Override
public LukeSkywalkerEmblemEffect copy() {
return new LukeSkywalkerEmblemEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getPhase().getType() == TurnPhase.COMBAT
&& super.applies(event, source, game)
&& event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && game.getState().getPlayersInRange(controller.getId(), game).contains(event.getTargetId())) {
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,39 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.MonstrosityAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.Collections;
/**
*
* @author NinthWorld
*/
public final class PorgToken extends TokenImpl {
public PorgToken() {
super("Porg", "0/1 green Bird creature token named Porg with \"{G}: Monstrosity 1.\"");
availableImageSetCodes.addAll(Collections.singletonList("SWS"));
cardType.add(CardType.CREATURE);
subtype.add(SubType.BIRD);
color.setGreen(true);
power = new MageInt(0);
toughness = new MageInt(1);
this.addAbility(new MonstrosityAbility("{G}", 1));
}
public PorgToken(final PorgToken token) {
super(token);
}
public PorgToken copy() {
return new PorgToken(this);
}
}

View file

@ -0,0 +1,36 @@
package mage.game.permanent.token;
import java.util.Collections;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author NinthWorld
*/
public final class TrooperToken2 extends TokenImpl {
public TrooperToken2() {
super("Trooper", "1/1 black Trooper creature token");
availableImageSetCodes.addAll(Collections.singletonList("SWS"));
this.setTokenType(2);
cardType.add(CardType.CREATURE);
subtype.add(SubType.TROOPER);
color.setBlack(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
public TrooperToken2(final TrooperToken2 token) {
super(token);
}
public TrooperToken2 copy() {
return new TrooperToken2(this);
}
}

View file

@ -0,0 +1,84 @@
package mage.watchers.common;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
/*
* Counts amount of life lost from noncombat sources current or last turn by players.
* This watcher is automatically started in gameImpl.init for each game
*
* @author NinthWorld
*/
public class PlayerLostLifeNonCombatWatcher extends Watcher {
private final Map<UUID, Integer> amountOfLifeLostThisTurn = new HashMap<>();
private final Map<UUID, Integer> amountOfLifeLostLastTurn = new HashMap<>();
public PlayerLostLifeNonCombatWatcher() {
super(PlayerLostLifeNonCombatWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public PlayerLostLifeNonCombatWatcher(final PlayerLostLifeNonCombatWatcher watcher) {
super(watcher);
for (Entry<UUID, Integer> entry : watcher.amountOfLifeLostThisTurn.entrySet()) {
amountOfLifeLostThisTurn.put(entry.getKey(), entry.getValue());
}
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.LOST_LIFE && !event.getFlag()) {
UUID playerId = event.getPlayerId();
if (playerId != null) {
Integer amount = amountOfLifeLostThisTurn.get(playerId);
if (amount == null) {
amount = event.getAmount();
} else {
amount = amount + event.getAmount();
}
amountOfLifeLostThisTurn.put(playerId, amount);
}
}
}
public int getLiveLost(UUID playerId) {
return amountOfLifeLostThisTurn.getOrDefault(playerId, 0);
}
public int getAllOppLifeLost(UUID playerId, Game game) {
int amount = 0;
for (UUID opponentId : this.amountOfLifeLostThisTurn.keySet()) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null && opponent.hasOpponent(playerId, game)) {
amount += this.amountOfLifeLostThisTurn.getOrDefault(opponentId, 0);
}
}
return amount;
}
public int getLiveLostLastTurn(UUID playerId) {
return amountOfLifeLostLastTurn.getOrDefault(playerId, 0);
}
@Override
public void reset() {
amountOfLifeLostLastTurn.clear();
amountOfLifeLostLastTurn.putAll(amountOfLifeLostThisTurn);
amountOfLifeLostThisTurn.clear();
}
@Override
public PlayerLostLifeNonCombatWatcher copy() {
return new PlayerLostLifeNonCombatWatcher(this);
}
}