mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Clean up
This commit is contained in:
@@ -671,7 +671,6 @@ public class ComputerUtilCombat {
|
|||||||
|
|
||||||
int flankingMagnitude = 0;
|
int flankingMagnitude = 0;
|
||||||
if (attacker.hasKeyword(Keyword.FLANKING) && !blocker.hasKeyword(Keyword.FLANKING)) {
|
if (attacker.hasKeyword(Keyword.FLANKING) && !blocker.hasKeyword(Keyword.FLANKING)) {
|
||||||
|
|
||||||
flankingMagnitude = attacker.getAmountOfKeyword(Keyword.FLANKING);
|
flankingMagnitude = attacker.getAmountOfKeyword(Keyword.FLANKING);
|
||||||
|
|
||||||
if (flankingMagnitude >= blocker.getNetToughness()) {
|
if (flankingMagnitude >= blocker.getNetToughness()) {
|
||||||
|
|||||||
@@ -361,8 +361,7 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
for (Card c: topN) {
|
for (Card c: topN) {
|
||||||
if (ComputerUtil.scryWillMoveCardToBottomOfLibrary(player, c)) {
|
if (ComputerUtil.scryWillMoveCardToBottomOfLibrary(player, c)) {
|
||||||
toBottom.add(c);
|
toBottom.add(c);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
toTop.add(c);
|
toTop.add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -525,8 +524,7 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
if (copySA instanceof Spell) {
|
if (copySA instanceof Spell) {
|
||||||
Spell spell = (Spell) copySA;
|
Spell spell = (Spell) copySA;
|
||||||
((PlayerControllerAi) player.getController()).getAi().canPlayFromEffectAI(spell, true, true);
|
((PlayerControllerAi) player.getController()).getAi().canPlayFromEffectAI(spell, true, true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
getAi().canPlaySa(copySA);
|
getAi().canPlaySa(copySA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -884,9 +882,8 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
byte chosenColorMask = MagicColor.fromName(c);
|
byte chosenColorMask = MagicColor.fromName(c);
|
||||||
if ((colors.getColor() & chosenColorMask) != 0) {
|
if ((colors.getColor() & chosenColorMask) != 0) {
|
||||||
return chosenColorMask;
|
return chosenColorMask;
|
||||||
} else {
|
|
||||||
return Iterables.getFirst(colors, (byte)0);
|
|
||||||
}
|
}
|
||||||
|
return Iterables.getFirst(colors, (byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -905,10 +902,8 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
if ((colors.getColor() & chosenColorMask) != 0) {
|
if ((colors.getColor() & chosenColorMask) != 0) {
|
||||||
return chosenColorMask;
|
return chosenColorMask;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return Iterables.getFirst(colors, MagicColor.WHITE);
|
return Iterables.getFirst(colors, MagicColor.WHITE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICardFace chooseSingleCardFace(SpellAbility sa, String message,
|
public ICardFace chooseSingleCardFace(SpellAbility sa, String message,
|
||||||
@@ -1370,8 +1365,7 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int chooseNumberForKeywordCost(SpellAbility sa, Cost cost, KeywordInterface keyword, String prompt,
|
public int chooseNumberForKeywordCost(SpellAbility sa, Cost cost, KeywordInterface keyword, String prompt, int max) {
|
||||||
int max) {
|
|
||||||
// TODO: improve the logic depending on the keyword and the playability of the cost-modified SA (enough targets present etc.)
|
// TODO: improve the logic depending on the keyword and the playability of the cost-modified SA (enough targets present etc.)
|
||||||
int chosenAmount = 0;
|
int chosenAmount = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -330,7 +330,6 @@ public class DamageDealAi extends DamageAiBase {
|
|||||||
*/
|
*/
|
||||||
private Card dealDamageChooseTgtC(final Player ai, final SpellAbility sa, final int d, final boolean noPrevention,
|
private Card dealDamageChooseTgtC(final Player ai, final SpellAbility sa, final int d, final boolean noPrevention,
|
||||||
final Player pl, final boolean mandatory) {
|
final Player pl, final boolean mandatory) {
|
||||||
|
|
||||||
// wait until stack is empty (prevents duplicate kills)
|
// wait until stack is empty (prevents duplicate kills)
|
||||||
if (!sa.isTrigger() && !ai.getGame().getStack().isEmpty()) {
|
if (!sa.isTrigger() && !ai.getGame().getStack().isEmpty()) {
|
||||||
//TODO:all removal APIs require a check to prevent duplicate kill/bounce/exile/etc.
|
//TODO:all removal APIs require a check to prevent duplicate kill/bounce/exile/etc.
|
||||||
@@ -345,7 +344,7 @@ public class DamageDealAi extends DamageAiBase {
|
|||||||
final Player activator = sa.getActivatingPlayer();
|
final Player activator = sa.getActivatingPlayer();
|
||||||
final Card source = sa.getHostCard();
|
final Card source = sa.getHostCard();
|
||||||
final Game game = source.getGame();
|
final Game game = source.getGame();
|
||||||
List<Card> hPlay = getTargetableCards(ai, sa, pl, tgt, activator, source, game);
|
List<Card> hPlay = getTargetableCards(mandatory ? pl : ai, sa, pl, tgt, activator, source, game);
|
||||||
|
|
||||||
// Filter MustTarget requirements
|
// Filter MustTarget requirements
|
||||||
StaticAbilityMustTarget.filterMustTargetCards(ai, hPlay, sa);
|
StaticAbilityMustTarget.filterMustTargetCards(ai, hPlay, sa);
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ public class CharmEffect extends SpellAbilityEffect {
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (AbilitySub sub : chosen) {
|
for (AbilitySub sub : chosen) {
|
||||||
// Clone the chosen, just in case the some subAb gets chosen multiple times
|
// Clone the chosen, just in case the same subAb gets chosen multiple times
|
||||||
AbilitySub clone = (AbilitySub)sub.copy();
|
AbilitySub clone = (AbilitySub)sub.copy();
|
||||||
|
|
||||||
// update ActivatingPlayer
|
// update ActivatingPlayer
|
||||||
@@ -250,7 +250,6 @@ public class CharmEffect extends SpellAbilityEffect {
|
|||||||
// add Clone to Tail of sa
|
// add Clone to Tail of sa
|
||||||
sa.appendSubAbility(clone);
|
sa.appendSubAbility(clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3580,10 +3580,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearChangedCardKeywords() {
|
|
||||||
return clearChangedCardKeywords(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean clearChangedCardColors() {
|
public boolean clearChangedCardColors() {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
@@ -4268,6 +4264,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean clearChangedCardKeywords() {
|
||||||
|
return clearChangedCardKeywords(false);
|
||||||
|
}
|
||||||
public final boolean clearChangedCardKeywords(final boolean updateView) {
|
public final boolean clearChangedCardKeywords(final boolean updateView) {
|
||||||
if (changedCardKeywords.isEmpty()) {
|
if (changedCardKeywords.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user