mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
@@ -4097,7 +4097,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
return state.getType();
|
||||
}
|
||||
|
||||
// TODO add changed type by card text
|
||||
public Iterable<CardChangedType> getChangedCardTypes() {
|
||||
// If there are no changed types, just return an empty immutable list, which actually
|
||||
// produces a surprisingly large speedup by avoid lots of temp objects and making iteration
|
||||
@@ -5702,7 +5701,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
|
||||
// Just phased in, time to run the phased in trigger
|
||||
getGame().getTriggerHandler().registerActiveTrigger(this, false);
|
||||
getGame().getTriggerHandler().runTrigger(TriggerType.PhaseIn, runParams, false);
|
||||
getGame().getTriggerHandler().runTrigger(TriggerType.PhaseIn, runParams, true);
|
||||
}
|
||||
|
||||
game.updateLastStateForCard(this);
|
||||
|
||||
@@ -414,7 +414,7 @@ public class CardLists {
|
||||
public static int getTotalPower(Iterable<Card> cardList, boolean ignoreNegativePower, boolean crew) {
|
||||
int total = 0;
|
||||
for (final Card crd : cardList) {
|
||||
if (crew && StaticAbilityCrewValue.hasAnyCrewValue(crd)) {
|
||||
if (crew) {
|
||||
if (StaticAbilityCrewValue.crewsWithToughness(crd)) {
|
||||
total += ignoreNegativePower ? Math.max(0, crd.getNetToughness()) : crd.getNetToughness();
|
||||
} else {
|
||||
|
||||
@@ -1628,8 +1628,7 @@ public class CardProperty {
|
||||
}
|
||||
}
|
||||
if (property.startsWith("attacking ")) { // generic "attacking [DefinedGameEntity]"
|
||||
FCollection<GameEntity> defined = AbilityUtils.getDefinedEntities(source, property.split(" ")[1],
|
||||
spellAbility);
|
||||
FCollection<GameEntity> defined = AbilityUtils.getDefinedEntities(source, property.split(" ")[1], spellAbility);
|
||||
final GameEntity defender = combat.getDefenderByAttacker(card);
|
||||
if (!defined.contains(defender)) {
|
||||
return false;
|
||||
|
||||
@@ -100,15 +100,16 @@ public class CardZoneTable extends ForwardingTable<ZoneType, ZoneType, CardColle
|
||||
// will be handled by original "cause" instead
|
||||
return;
|
||||
}
|
||||
// this should still refresh for empty battlefield
|
||||
if (lastStateBattlefield != CardCollection.EMPTY) {
|
||||
game.getTriggerHandler().resetActiveTriggers(false);
|
||||
// register all LTB trigger from last state battlefield
|
||||
for (Card lki : lastStateBattlefield) {
|
||||
game.getTriggerHandler().registerActiveLTBTrigger(lki);
|
||||
}
|
||||
}
|
||||
if (!isEmpty()) {
|
||||
// this should still refresh for empty battlefield
|
||||
if (lastStateBattlefield != CardCollection.EMPTY) {
|
||||
game.getTriggerHandler().resetActiveTriggers(false);
|
||||
// register all LTB trigger from last state battlefield
|
||||
for (Card lki : lastStateBattlefield) {
|
||||
game.getTriggerHandler().registerActiveLTBTrigger(lki);
|
||||
}
|
||||
}
|
||||
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Cards, new CardZoneTable(this));
|
||||
runParams.put(AbilityKey.Cause, cause);
|
||||
|
||||
@@ -232,7 +232,7 @@ public class Untap extends Phase {
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Map, untapMap);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.UntapAll, runParams, false);
|
||||
} // end doUntap
|
||||
}
|
||||
|
||||
private static boolean optionalUntap(final Card c) {
|
||||
boolean untap = true;
|
||||
@@ -301,6 +301,10 @@ public class Untap extends Phase {
|
||||
runParams.put(AbilityKey.Cards, phasedOut);
|
||||
turn.getGame().getTriggerHandler().runTrigger(TriggerType.PhaseOutAll, runParams, false);
|
||||
}
|
||||
if (!toPhase.isEmpty()) {
|
||||
// collect now before some zone change during Untap resets triggers
|
||||
turn.getGame().getTriggerHandler().collectTriggerForWaiting();
|
||||
}
|
||||
}
|
||||
|
||||
private static void doDayTime(final Player previous) {
|
||||
|
||||
@@ -8,25 +8,6 @@ public class StaticAbilityCrewValue {
|
||||
|
||||
static String MODE = "CrewValue";
|
||||
|
||||
public static boolean hasAnyCrewValue(final Card card) {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (hasAnyCrewValue(stAb, card)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasAnyCrewValue(final StaticAbility stAb, final Card card) {
|
||||
return stAb.matchesValidParam("ValidCard", card);
|
||||
}
|
||||
|
||||
public static boolean crewsWithToughness(final Card card) {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
|
||||
Reference in New Issue
Block a user