mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Jabari's Influence: multiplayer fix (#375)
* Jabari's Influence: multiplayer fix
This commit is contained in:
@@ -6218,11 +6218,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
setBecameTargetThisTurn(false);
|
||||
setFoughtThisTurn(false);
|
||||
clearMustBlockCards();
|
||||
getDamageHistory().setCreatureAttackedLastTurnOf(turn, getDamageHistory().getCreatureAttacksThisTurn() > 0);
|
||||
getDamageHistory().newTurn();
|
||||
getDamageHistory().setCreatureAttackedLastTurnOf(turn, getDamageHistory().getCreatureAttackedThisTurn());
|
||||
getDamageHistory().setCreatureAttackedThisTurn(false);
|
||||
getDamageHistory().setCreatureAttacksThisTurn(0);
|
||||
getDamageHistory().setHasBeenDealtNonCombatDamageThisTurn(false);
|
||||
clearBlockedByThisTurn();
|
||||
clearBlockedThisTurn();
|
||||
resetMayPlayTurn();
|
||||
|
||||
@@ -16,12 +16,11 @@ import forge.game.player.Player;
|
||||
*/
|
||||
public class CardDamageHistory {
|
||||
|
||||
private boolean creatureAttackedThisTurn = false;
|
||||
private boolean creatureAttackedThisCombat = false;
|
||||
private boolean creatureBlockedThisCombat = false;
|
||||
private boolean creatureGotBlockedThisCombat = false;
|
||||
private boolean receivedNonCombatDamageThisTurn = false;
|
||||
private int attacksThisTurn = 0;
|
||||
private List<GameEntity> attackedThisTurn = Lists.newArrayList();
|
||||
|
||||
private final List<Player> creatureAttackedLastTurnOf = Lists.newArrayList();
|
||||
private final List<Player> NotAttackedSinceLastUpkeepOf = Lists.newArrayList();
|
||||
@@ -47,12 +46,11 @@ public class CardDamageHistory {
|
||||
* @param hasAttacked
|
||||
* a boolean.
|
||||
*/
|
||||
public final void setCreatureAttackedThisCombat(final boolean hasAttacked) {
|
||||
this.creatureAttackedThisCombat = hasAttacked;
|
||||
public final void setCreatureAttackedThisCombat(GameEntity defender) {
|
||||
this.creatureAttackedThisCombat = defender != null;
|
||||
|
||||
if (hasAttacked) {
|
||||
this.setCreatureAttackedThisTurn(true);
|
||||
this.attacksThisTurn++;
|
||||
if (defender != null) {
|
||||
attackedThisTurn.add(defender);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -65,38 +63,6 @@ public class CardDamageHistory {
|
||||
public final boolean getCreatureAttackedThisCombat() {
|
||||
return this.creatureAttackedThisCombat;
|
||||
}
|
||||
/**
|
||||
* <p>
|
||||
* Setter for the field <code>creatureAttackedThisTurn</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param b
|
||||
* a boolean.
|
||||
*/
|
||||
public final void setCreatureAttackedThisTurn(final boolean b) {
|
||||
this.creatureAttackedThisTurn = b;
|
||||
}
|
||||
/**
|
||||
* <p>
|
||||
* Getter for the field <code>creatureAttackedThisTurn</code>.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean getCreatureAttackedThisTurn() {
|
||||
return this.creatureAttackedThisTurn;
|
||||
}
|
||||
/**
|
||||
* <p>
|
||||
* Setter for the field <code>attacksThisTurn</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param num
|
||||
* a integer.
|
||||
*/
|
||||
public final void setCreatureAttacksThisTurn(final int num) {
|
||||
this.attacksThisTurn = num;
|
||||
}
|
||||
/**
|
||||
* <p>
|
||||
* Getter for the field <code>attacksThisTurn</code>.
|
||||
@@ -105,7 +71,10 @@ public class CardDamageHistory {
|
||||
* @return a int.
|
||||
*/
|
||||
public final int getCreatureAttacksThisTurn() {
|
||||
return this.attacksThisTurn;
|
||||
return this.attackedThisTurn.size();
|
||||
}
|
||||
public final boolean hasAttackedThisTurn(GameEntity e) {
|
||||
return this.attackedThisTurn.contains(e);
|
||||
}
|
||||
/**
|
||||
* <p>
|
||||
@@ -307,6 +276,8 @@ public class CardDamageHistory {
|
||||
damagedThisCombat.clear();
|
||||
damagedThisTurnInCombat.clear();
|
||||
damagedThisTurn.clear();
|
||||
attackedThisTurn.clear();
|
||||
setHasBeenDealtNonCombatDamageThisTurn(false);
|
||||
}
|
||||
|
||||
public void endCombat() {
|
||||
|
||||
@@ -1188,7 +1188,11 @@ public class CardProperty {
|
||||
} else if (property.startsWith("dealtDamagetoAny")) {
|
||||
return card.getDamageHistory().getHasdealtDamagetoAny();
|
||||
} else if (property.startsWith("attackedThisTurn")) {
|
||||
if (!card.getDamageHistory().getCreatureAttackedThisTurn()) {
|
||||
if (card.getDamageHistory().getCreatureAttacksThisTurn() == 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("attackedYouThisTurn")) {
|
||||
if (!card.getDamageHistory().hasAttackedThisTurn(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("attackedLastTurn")) {
|
||||
@@ -1210,7 +1214,7 @@ public class CardProperty {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("notAttackedThisTurn")) {
|
||||
if (card.getDamageHistory().getCreatureAttackedThisTurn()) {
|
||||
if (card.getDamageHistory().getCreatureAttacksThisTurn() > 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("notAttackedLastTurn")) {
|
||||
|
||||
@@ -383,6 +383,8 @@ public class CombatUtil {
|
||||
* a {@link forge.game.card.Card} object.
|
||||
*/
|
||||
public static void checkDeclaredAttacker(final Game game, final Card c, final Combat combat, boolean triggers) {
|
||||
GameEntity defender = combat.getDefenderByAttacker(c);
|
||||
|
||||
// Run triggers
|
||||
if (triggers) {
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
@@ -390,7 +392,7 @@ public class CombatUtil {
|
||||
final List<Card> otherAttackers = combat.getAttackers();
|
||||
otherAttackers.remove(c);
|
||||
runParams.put(AbilityKey.OtherAttackers, otherAttackers);
|
||||
runParams.put(AbilityKey.Attacked, combat.getDefenderByAttacker(c));
|
||||
runParams.put(AbilityKey.Attacked, defender);
|
||||
runParams.put(AbilityKey.DefendingPlayer, combat.getDefenderPlayerByAttacker(c));
|
||||
// only add defenders that were attacked
|
||||
final FCollection<GameEntity> defenders = new FCollection<>();
|
||||
@@ -403,7 +405,7 @@ public class CombatUtil {
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Attacks, runParams, false);
|
||||
}
|
||||
|
||||
c.getDamageHistory().setCreatureAttackedThisCombat(true);
|
||||
c.getDamageHistory().setCreatureAttackedThisCombat(defender);
|
||||
c.getDamageHistory().clearNotAttackedSinceLastUpkeepOf();
|
||||
c.getController().addCreaturesAttackedThisTurn(CardUtil.getLKICopy(c));
|
||||
}
|
||||
|
||||
@@ -2661,7 +2661,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
for (Card c : list) {
|
||||
if (c.getDamageHistory().getCreatureAttackedThisCombat()) {
|
||||
c.getDamageHistory().setCreatureAttackedThisCombat(false);
|
||||
c.getDamageHistory().setCreatureAttackedThisCombat(null);
|
||||
}
|
||||
if (c.getDamageHistory().getCreatureBlockedThisCombat()) {
|
||||
c.getDamageHistory().setCreatureBlockedThisCombat(false);
|
||||
|
||||
@@ -163,6 +163,10 @@ public class PlayerProperty {
|
||||
if (game.getCombat() == null || !player.equals(game.getCombat().getDefenderPlayerByAttacker(source))) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("attackedBySourceThisTurn")) {
|
||||
if (!source.getDamageHistory().hasAttackedThisTurn(player)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("wasDealtDamageThisTurn")) {
|
||||
if (player.getAssignedDamage() == 0) {
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Name:Jabari's Influence
|
||||
ManaCost:3 W W
|
||||
Types:Instant
|
||||
A:SP$ GainControl | Cost$ 3 W W | ValidTgts$ Creature.nonBlack+nonArtifact+attackedThisTurn | TgtPrompt$ Select target nonartifact, nonblack creature that attacked you this turn | OpponentTurn$ True | ActivationPhases$ Main2->Cleanup | SubAbility$ DBPutCounter | SpellDescription$ Gain control of target nonartifact, nonblack creature that attacked you this turn and put a -1/-0 counter on it.
|
||||
A:SP$ GainControl | Cost$ 3 W W | ValidTgts$ Creature.nonBlack+nonArtifact+attackedYouThisTurn | TgtPrompt$ Select target nonartifact, nonblack creature that attacked you this turn | ActivationPhases$ Main2->Cleanup | SubAbility$ DBPutCounter | SpellDescription$ Gain control of target nonartifact, nonblack creature that attacked you this turn and put a -1/-0 counter on it.
|
||||
SVar:DBPutCounter:DB$ PutCounter | Defined$ Targeted | CounterType$ M1M0 | CounterNum$ 1
|
||||
Oracle:Cast this spell only after combat.\nGain control of target nonartifact, nonblack creature that attacked you this turn and put a -1/-0 counter on it.
|
||||
|
||||
@@ -2,13 +2,8 @@ Name:Port Razer
|
||||
ManaCost:3 R R
|
||||
Types:Creature Orc Pirate
|
||||
PT:4/4
|
||||
T:Mode$ TurnBegin | ValidPlayer$ Player | Static$ True | Execute$ AttackReset
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Static$ True | Execute$ AttackReset
|
||||
SVar:AttackReset:DB$ Cleanup | ClearRemembered$ True
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ RememberPlayer | TriggerZones$ Battlefield | Static$ True
|
||||
SVar:RememberPlayer:DB$ Pump | RememberObjects$ TriggeredDefendingPlayer
|
||||
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigUntap | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, untap each creature you control. After this combat phase, there is an additional combat phase.
|
||||
SVar:TrigUntap:DB$ UntapAll | ValidCards$ Creature.YouCtrl | SubAbility$ DBAddCombat
|
||||
SVar:DBAddCombat:DB$ AddPhase | ExtraPhase$ Combat | AfterPhase$ EndCombat
|
||||
S:Mode$ CantAttack | ValidCard$ Card.Self | Target$ Player.IsRemembered | Description$ CARDNAME can't attack a player it has already attacked this turn.
|
||||
S:Mode$ CantAttack | ValidCard$ Card.Self | Target$ Player.attackedBySourceThisTurn | Description$ CARDNAME can't attack a player it has already attacked this turn.
|
||||
Oracle:Whenever Port Razer deals combat damage to a player, untap each creature you control. After this combat phase, there is an additional combat phase.\nPort Razer can't attack a player it has already attacked this turn.
|
||||
|
||||
Reference in New Issue
Block a user