mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +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()) {
|
if (!hasDealtDamageToOpponentThisTurn()) {
|
||||||
return false;
|
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")) {
|
} else if (property.startsWith("controllerWasDealtCombatDamageByThisTurn")) {
|
||||||
if (!source.getDamageHistory().getThisTurnCombatDamaged().contains(controller)) {
|
if (!source.getDamageHistory().getThisTurnCombatDamaged().contains(controller)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ package forge.game.card;
|
|||||||
import forge.game.GameEntity;
|
import forge.game.GameEntity;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@@ -316,9 +315,15 @@ public class CardDamageHistory {
|
|||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
*/
|
*/
|
||||||
public void newTurn() {
|
public void newTurn() {
|
||||||
|
damagedThisCombat.clear();
|
||||||
damagedThisTurnInCombat.clear();
|
damagedThisTurnInCombat.clear();
|
||||||
damagedThisTurn.clear();
|
damagedThisTurn.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void endCombat() {
|
||||||
|
damagedThisCombat.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
* @param player
|
* @param player
|
||||||
|
|||||||
@@ -101,9 +101,11 @@ public class Combat {
|
|||||||
|
|
||||||
//update view for all attackers and blockers
|
//update view for all attackers and blockers
|
||||||
for (Card c : attackers) {
|
for (Card c : attackers) {
|
||||||
|
c.getDamageHistory().endCombat();
|
||||||
c.updateAttackingForView();
|
c.updateAttackingForView();
|
||||||
}
|
}
|
||||||
for (Card c : blockers) {
|
for (Card c : blockers) {
|
||||||
|
c.getDamageHistory().endCombat();
|
||||||
c.updateBlockingForView();
|
c.updateBlockingForView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,6 +738,7 @@ public class Combat {
|
|||||||
|
|
||||||
for (final Entry<Card, Integer> entry : assignedDamageMap.entrySet()) {
|
for (final Entry<Card, Integer> entry : assignedDamageMap.entrySet()) {
|
||||||
final Card crd = entry.getKey();
|
final Card crd = entry.getKey();
|
||||||
|
c.getDamageHistory().registerCombatDamage(crd);
|
||||||
damageMap.put(crd, entry.getValue());
|
damageMap.put(crd, entry.getValue());
|
||||||
if (entry.getValue() > 0) {
|
if (entry.getValue() > 0) {
|
||||||
if (damageDealtThisCombat.containsKey(crd)) {
|
if (damageDealtThisCombat.containsKey(crd)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user