mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
CardDamageHistory & Combat: add logic so it does register CombatDamage dealt between creatures
Card: add dealtCombatDamageThisTurn <valid> for better checking if Card dealt combat damage to something this turn
This commit is contained in:
@@ -4717,6 +4717,19 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
if (!hasDealtDamageToOpponentThisTurn()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("dealtCombatDamageThisTurn ")) {
|
||||
final String v = property.split(" ")[1];
|
||||
final List<GameEntity> list = getDamageHistory().getThisTurnCombatDamaged();
|
||||
boolean found = false;
|
||||
for (final GameEntity e : list) {
|
||||
if (e.isValid(v, sourceController, source, spellAbility)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("controllerWasDealtCombatDamageByThisTurn")) {
|
||||
if (!source.getDamageHistory().getThisTurnCombatDamaged().contains(controller)) {
|
||||
return false;
|
||||
|
||||
@@ -4,7 +4,6 @@ package forge.game.card;
|
||||
import forge.game.GameEntity;
|
||||
import forge.game.player.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -316,9 +315,15 @@ public class CardDamageHistory {
|
||||
* TODO: Write javadoc for this method.
|
||||
*/
|
||||
public void newTurn() {
|
||||
damagedThisCombat.clear();
|
||||
damagedThisTurnInCombat.clear();
|
||||
damagedThisTurn.clear();
|
||||
}
|
||||
|
||||
public void endCombat() {
|
||||
damagedThisCombat.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @param player
|
||||
|
||||
@@ -101,9 +101,11 @@ public class Combat {
|
||||
|
||||
//update view for all attackers and blockers
|
||||
for (Card c : attackers) {
|
||||
c.getDamageHistory().endCombat();
|
||||
c.updateAttackingForView();
|
||||
}
|
||||
for (Card c : blockers) {
|
||||
c.getDamageHistory().endCombat();
|
||||
c.updateBlockingForView();
|
||||
}
|
||||
}
|
||||
@@ -736,6 +738,7 @@ public class Combat {
|
||||
|
||||
for (final Entry<Card, Integer> entry : assignedDamageMap.entrySet()) {
|
||||
final Card crd = entry.getKey();
|
||||
c.getDamageHistory().registerCombatDamage(crd);
|
||||
damageMap.put(crd, entry.getValue());
|
||||
if (entry.getValue() > 0) {
|
||||
if (damageDealtThisCombat.containsKey(crd)) {
|
||||
|
||||
Reference in New Issue
Block a user