mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Added the function removeAll to CardList to remove all instances of a card from it (I was shocked that we didn't have this, or am I missing something?).
- Fixed some possible bugs of assigning blockers twice in ComputerUtil_Block2.
This commit is contained in:
@@ -574,6 +574,17 @@ public class CardList implements Iterable<Card> {
|
||||
public void remove(Card c) {
|
||||
list.remove(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>removeAll.</p>
|
||||
*
|
||||
* @param c a {@link forge.Card} object.
|
||||
*/
|
||||
public void removeAll(Card c) {
|
||||
ArrayList<Card> cList = new ArrayList<Card>();
|
||||
cList.add(c);
|
||||
list.removeAll(cList);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>clear.</p>
|
||||
|
||||
@@ -505,7 +505,7 @@ public class ComputerUtil_Block2 {
|
||||
&& CardFactoryUtil.evaluateCreature(blocker) + getDiff() < CardFactoryUtil.evaluateCreature(attacker)
|
||||
&& CombatUtil.canBlock(attacker, blocker, combat)) {
|
||||
combat.addBlocker(attacker, blocker);
|
||||
getBlockersLeft().remove(blocker);
|
||||
getBlockersLeft().removeAll(blocker);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -630,7 +630,7 @@ public class ComputerUtil_Block2 {
|
||||
for (Card blocker : blockers) {
|
||||
if (CombatUtil.canBlock(attacker, blocker, combat)) {
|
||||
combat.addBlocker(attacker, blocker);
|
||||
getBlockersLeft().remove(blocker);
|
||||
getBlockersLeft().removeAll(blocker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user