mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
HiddenStaticAbilities: add Statics without the need for Effect objects
This commit is contained in:
@@ -1103,11 +1103,16 @@ public class GameAction {
|
||||
if (stAb.checkMode(StaticAbilityMode.Continuous) && stAb.zonesCheck()) {
|
||||
staticAbilities.add(stAb);
|
||||
}
|
||||
}
|
||||
if (!co.getStaticCommandList().isEmpty()) {
|
||||
staticList.add(co);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!co.getStaticCommandList().isEmpty()) {
|
||||
staticList.add(co);
|
||||
}
|
||||
for (StaticAbility stAb : co.getHiddenStaticAbilities()) {
|
||||
if (stAb.checkMode(StaticAbilityMode.Continuous) && stAb.zonesCheck()) {
|
||||
staticAbilities.add(stAb);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
private boolean renowned;
|
||||
private boolean solved;
|
||||
private boolean tributed;
|
||||
private Card suspectedEffect = null;
|
||||
private StaticAbility suspectedStatic = null;
|
||||
|
||||
private SpellAbility manifestedSA;
|
||||
private SpellAbility cloakedSA;
|
||||
@@ -6758,15 +6758,15 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
return true;
|
||||
}
|
||||
|
||||
public Card getSuspectedEffect() {
|
||||
return this.suspectedEffect;
|
||||
public StaticAbility getSuspectedStatic() {
|
||||
return this.suspectedStatic;
|
||||
}
|
||||
public void setSuspectedEffect(Card effect) {
|
||||
this.suspectedEffect = effect;
|
||||
public void setSuspectedStatic(StaticAbility stAb) {
|
||||
this.suspectedStatic = stAb;
|
||||
}
|
||||
|
||||
public final boolean isSuspected() {
|
||||
return suspectedEffect != null;
|
||||
return suspectedStatic != null;
|
||||
}
|
||||
|
||||
public final boolean setSuspected(final boolean suspected) {
|
||||
@@ -6779,23 +6779,15 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
return true;
|
||||
}
|
||||
|
||||
suspectedEffect = SpellAbilityEffect.createEffect(null, this, this.getController(), "Suspected Effect", getImageKey(), getGame().getNextTimestamp());
|
||||
suspectedEffect.setRenderForUI(false);
|
||||
suspectedEffect.addRemembered(this);
|
||||
String s = "Mode$ Continuous | AffectedDefined$ Self | AddKeyword$ Menace | AddStaticAbility$ SuspectedCantBlockBy";
|
||||
suspectedStatic = StaticAbility.create(s, this, currentState, true);
|
||||
suspectedStatic.putParam("Timestamp", String.valueOf(getGame().getNextTimestamp()));
|
||||
|
||||
String s = "Mode$ Continuous | AffectedDefined$ RememberedCard | EffectZone$ Command | AddKeyword$ Menace | AddStaticAbility$ SuspectedCantBlockBy";
|
||||
StaticAbility suspectedStatic = suspectedEffect.addStaticAbility(s);
|
||||
String effect = "Mode$ CantBlock | ValidCard$ Creature.Self | Description$ CARDNAME can't block.";
|
||||
suspectedStatic.setSVar("SuspectedCantBlockBy", effect);
|
||||
|
||||
GameCommand until = SpellAbilityEffect.exileEffectCommand(getGame(), suspectedEffect);
|
||||
addLeavesPlayCommand(until);
|
||||
getGame().getAction().moveToCommand(suspectedEffect, null);
|
||||
} else {
|
||||
if (isSuspected()) {
|
||||
getGame().getAction().exileEffect(suspectedEffect);
|
||||
suspectedEffect = null;
|
||||
}
|
||||
suspectedStatic = null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -7293,6 +7285,15 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
}
|
||||
}
|
||||
|
||||
public final FCollectionView<StaticAbility> getHiddenStaticAbilities() {
|
||||
FCollection<StaticAbility> result = new FCollection<>();
|
||||
// Suspected
|
||||
if (this.isInPlay() && this.isSuspected()) {
|
||||
result.add(suspectedStatic);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public final FCollectionView<Trigger> getTriggers() {
|
||||
return currentState.getTriggers();
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public class CardCopyService {
|
||||
newCopy.setSaddled(copyFrom.isSaddled());
|
||||
if (newCopy.isSaddled()) newCopy.setSaddledByThisTurn(copyFrom.getSaddledByThisTurn());
|
||||
if (copyFrom.isSuspected()) {
|
||||
newCopy.setSuspectedEffect(getLKICopy(copyFrom.getSuspectedEffect(), cachedMap));
|
||||
newCopy.setSuspectedStatic(copyFrom.getSuspectedStatic().copy(newCopy, true));
|
||||
}
|
||||
|
||||
newCopy.setDamageHistory(copyFrom.getDamageHistory());
|
||||
|
||||
@@ -297,7 +297,9 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
|
||||
* conditions are fulfilled.
|
||||
*/
|
||||
private boolean shouldApplyContinuousAbility(final StaticAbilityLayer layer, final boolean previousRun) {
|
||||
return layers.contains(layer) && checkConditions(StaticAbilityMode.Continuous) && (previousRun || getHostCard().getStaticAbilities().contains(this));
|
||||
return layers.contains(layer) && checkConditions(StaticAbilityMode.Continuous) && ( previousRun ||
|
||||
getHostCard().getStaticAbilities().contains(this) ||
|
||||
getHostCard().getHiddenStaticAbilities().contains(this));
|
||||
}
|
||||
|
||||
public final Cost getAttackCost(final Card attacker, final GameEntity target, final List<Card> attackersWithOptionalCost) {
|
||||
|
||||
Reference in New Issue
Block a user