mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Clean up
This commit is contained in:
@@ -242,7 +242,7 @@ public class ForgeScript {
|
||||
String[] k = property.split(" ", 2);
|
||||
String comparator = k[1].substring(0, 2);
|
||||
int y = AbilityUtils.calculateAmount(sa.getHostCard(), k[1].substring(2), sa);
|
||||
return Expressions.compare(sa.getPayingMana().size(), comparator, y);
|
||||
return Expressions.compare(sa.getTotalManaSpent(), comparator, y);
|
||||
} else if (property.startsWith("ManaFrom")) {
|
||||
final String fromWhat = property.substring(8);
|
||||
boolean found = false;
|
||||
|
||||
@@ -8,7 +8,6 @@ import forge.game.ability.AbilityKey;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.token.TokenInfo;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.replacement.ReplacementResult;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
@@ -42,11 +41,6 @@ public class ReplaceEffect extends SpellAbilityEffect {
|
||||
if (list.size() > 0) {
|
||||
params.put(varName, list.get(0));
|
||||
}
|
||||
} else if ("TokenScript".equals(type)) {
|
||||
final Card protoType = TokenInfo.getProtoType(varValue, sa, sa.getActivatingPlayer());
|
||||
if (protoType != null) {
|
||||
params.put(varName, protoType);
|
||||
}
|
||||
} else {
|
||||
params.put(varName, AbilityUtils.calculateAmount(card, varValue, sa));
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ReplaceTokenEffect extends SpellAbilityEffect {
|
||||
} else if ("ReplaceToken".equals(sa.getParam("Type"))) {
|
||||
Card chosen = null;
|
||||
if (sa.hasParam("ValidChoices")) {
|
||||
CardCollectionView choices = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), sa.getParam("ValidChoices").split(","), p, card, sa);
|
||||
CardCollectionView choices = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), sa.getParam("ValidChoices"), p, card, sa);
|
||||
if (choices.isEmpty()) {
|
||||
originalParams.put(AbilityKey.ReplacementResult, ReplacementResult.NotReplaced);
|
||||
return;
|
||||
@@ -144,7 +144,7 @@ public class ReplaceTokenEffect extends SpellAbilityEffect {
|
||||
}
|
||||
} else if ("ReplaceController".equals(sa.getParam("Type"))) {
|
||||
long timestamp = game.getNextTimestamp();
|
||||
Player newController = sa.getActivatingPlayer();
|
||||
Player newController = p;
|
||||
if (sa.hasParam("NewController")) {
|
||||
newController = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("NewController"), sa).get(0);
|
||||
}
|
||||
|
||||
@@ -508,7 +508,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
view.updateState(this);
|
||||
view.updateNeedsTransformAnimation(needsTransformAnimation);
|
||||
|
||||
final Game game = getGame();
|
||||
if (game != null) {
|
||||
// update Type, color and keywords again if they have changed
|
||||
if (!changedCardTypes.isEmpty()) {
|
||||
|
||||
@@ -295,24 +295,16 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
||||
if (sa.getHostCard() != null) {
|
||||
sa.getHostCard().setCanCounter(true);
|
||||
}
|
||||
for (final Mana m : manaSpent) {
|
||||
player.getManaPool().addMana(m);
|
||||
}
|
||||
player.getManaPool().add(manaSpent);
|
||||
manaSpent.clear();
|
||||
}
|
||||
|
||||
public final void refundManaPaid(final SpellAbility sa) {
|
||||
// Send all mana back to your mana pool, before accounting for it.
|
||||
final List<Mana> manaPaid = sa.getPayingMana();
|
||||
|
||||
// move non-undoable paying mana back to floating
|
||||
if (sa.getHostCard() != null) {
|
||||
sa.getHostCard().setCanCounter(true);
|
||||
}
|
||||
for (final Mana m : manaPaid) {
|
||||
addMana(m);
|
||||
}
|
||||
manaPaid.clear();
|
||||
|
||||
refundMana(sa.getPayingMana(), owner, sa);
|
||||
|
||||
List<SpellAbility> payingAbilities = sa.getPayingManaAbilities();
|
||||
for (final SpellAbility am : payingAbilities) {
|
||||
|
||||
@@ -1412,8 +1412,8 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
}
|
||||
|
||||
String[] validTgt = tr.getValidTgts();
|
||||
if (entity instanceof GameEntity) {
|
||||
String[] validTgt = tr.getValidTgts();
|
||||
GameEntity e = (GameEntity)entity;
|
||||
if (!e.isValid(validTgt, getActivatingPlayer(), getHostCard(), this)) {
|
||||
return false;
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:W U
|
||||
Types:Legendary Creature Human Soldier
|
||||
PT:2/2
|
||||
S:Mode$ CantBeCast | ValidCard$ Card.nonCreature+nonLand | Caster$ Opponent | cmcGT$ Land | Description$ Each opponent can't cast noncreature spells with mana value greater than the number of lands that player controls.
|
||||
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | Execute$ TrigCounter | AmountManaSpent$ EQ0 | TriggerDescription$ Whenever an opponent casts a spell, if no mana was spent to cast it, counter that spell.
|
||||
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | Execute$ TrigCounter | ValidSA$ Spell.ManaSpent EQ0 | TriggerDescription$ Whenever an opponent casts a spell, if no mana was spent to cast it, counter that spell.
|
||||
SVar:TrigCounter:DB$ Counter | Defined$ TriggeredSpellAbility
|
||||
AI:RemoveDeck:Random
|
||||
Oracle:Each opponent can't cast noncreature spells with mana value greater than the number of lands that player controls.\nWhenever an opponent casts a spell, if no mana was spent to cast it, counter that spell.
|
||||
|
||||
@@ -5,7 +5,7 @@ PT:4/4
|
||||
S:Mode$ Continuous | Affected$ Creature.YouCtrl+hasManaAbility | AddPower$ 2 | AddToughness$ 2 | Description$ Each creature you control with a mana ability gets +2/+2.
|
||||
T:Mode$ Attacks | ValidCard$ Creature.YouCtrl+hasManaAbility | TriggerZones$ Battlefield | Execute$ TrigUntap | TriggerDescription$ Whenever a creature you control with a mana ability attacks, untap it.
|
||||
SVar:TrigUntap:DB$ Untap | Defined$ TriggeredAttacker
|
||||
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | AmountManaSpent$ GE7 | Execute$ TrigUntap2 | TriggerDescription$ Whenever you cast a spell, if at least seven mana was spent to cast it, untap target creature. It gets +7/+7 and gains trample until end of turn.
|
||||
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | ValidSA$ Spell.ManaSpent GE7 | Execute$ TrigUntap2 | TriggerDescription$ Whenever you cast a spell, if at least seven mana was spent to cast it, untap target creature. It gets +7/+7 and gains trample until end of turn.
|
||||
SVar:TrigUntap2:DB$ Untap | ValidTgts$ Creature | TgtPrompt$ Select target creature | SubAbility$ DBPump
|
||||
SVar:DBPump:DB$ Pump | Defined$ Targeted | NumAtt$ +7 | NumDef$ +7 | KW$ Trample
|
||||
SVar:PlayMain1:TRUE
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:1 R
|
||||
Types:Enchantment
|
||||
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ Trig1Damage | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's upkeep, CARDNAME deals 1 damage to them.
|
||||
SVar:Trig1Damage:DB$ DealDamage | Defined$ TriggeredPlayer | NumDmg$ 1
|
||||
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Player | TriggerZones$ Battlefield | Execute$ Trig5Damage | AmountManaSpent$ EQ0 | TriggerDescription$ Whenever a player casts a spell, if no mana was spent to cast that spell, CARDNAME deals 5 damage to that player.
|
||||
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Player | TriggerZones$ Battlefield | Execute$ Trig5Damage | ValidSA$ Spell.ManaSpent EQ0 | TriggerDescription$ Whenever a player casts a spell, if no mana was spent to cast that spell, CARDNAME deals 5 damage to that player.
|
||||
SVar:Trig5Damage:DB$ DealDamage | Defined$ TriggeredCardController | NumDmg$ 5
|
||||
A:AB$ Effect | Cost$ R | StaticAbilities$ STCantGain | AILogic$ NoGain | SpellDescription$ Your opponents can't gain life this turn.
|
||||
SVar:STCantGain:Mode$ CantGainLife | ValidPlayer$ Player.Opponent | Description$ Your opponents can't gain life this turn.
|
||||
|
||||
@@ -5,7 +5,7 @@ PT:3/3
|
||||
K:Haste
|
||||
A:AB$ Token | Cost$ T | ValidTgts$ Opponent | TokenAmount$ X | TokenScript$ c_a_treasure_sac | TokenOwner$ Targeted | SpellDescription$ Target opponent creates X Treasure tokens, where X is the number of Treasure tokens you created this turn.
|
||||
SVar:X:Count$ThisTurnEntered_Battlefield_Card.tokenCreated+Treasure+YouOwn
|
||||
T:Mode$ SpellAbilityCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | ManaFrom$ Treasure | Execute$ TrigPutCounter | TriggerDescription$ Whenever an opponent casts a spell or activates an ability, if mana from a Treasure was spent to cast or activate it, put a +1/+1 counter on target creature, then draw a card.
|
||||
T:Mode$ SpellAbilityCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | ValidSA$ SpellAbility.ManaFromTreasure | Execute$ TrigPutCounter | TriggerDescription$ Whenever an opponent casts a spell or activates an ability, if mana from a Treasure was spent to cast or activate it, put a +1/+1 counter on target creature, then draw a card.
|
||||
SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Creature | CounterType$ P1P1 | SubAbility$ DBDraw
|
||||
SVar:DBDraw:DB$ Draw
|
||||
DeckNeeds:Ability$Token & Type$Treasure
|
||||
|
||||
@@ -62,7 +62,7 @@ public class HumanPlaySpellAbility {
|
||||
|
||||
public final boolean playAbility(final boolean mayChooseTargets, final boolean isFree, final boolean skipStack) {
|
||||
final Player human = ability.getActivatingPlayer();
|
||||
final Game game = ability.getActivatingPlayer().getGame();
|
||||
final Game game = human.getGame();
|
||||
|
||||
// CR 401.5: freeze top library cards until cast so player can't cheat and see the next
|
||||
game.setTopLibsCast();
|
||||
|
||||
Reference in New Issue
Block a user