mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Another combat change: AI shouldn't attack into multiple first strikers anymore if it would destroy his attacker off the bat.
- Timetwister should not cause Megrim to trigger anymore. - Fixed issues with using the ability of Sakura-Tribe Elder after changing controllership.
This commit is contained in:
@@ -4124,13 +4124,17 @@ public class CardFactory implements NewConstants {
|
||||
void discardDraw7(String player) {
|
||||
// Discard hand into graveyard
|
||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
|
||||
Card[] c = hand.getCards();
|
||||
for(int i = 0; i < c.length; i++)
|
||||
AllZone.GameAction.discard(c[i]);
|
||||
|
||||
// Move graveyard into library
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
PlayerZone library = AllZone.getZone(Constant.Zone.Library, player);
|
||||
Card[] c = hand.getCards();
|
||||
for(int i = 0; i < c.length; i++) {
|
||||
//AllZone.GameAction.discard(c[i]);
|
||||
hand.remove(c[i]);
|
||||
library.add(c[i], 0);
|
||||
}
|
||||
|
||||
// Move graveyard into library
|
||||
|
||||
Card[] g = grave.getCards();
|
||||
for(int i = 0; i < g.length; i++) {
|
||||
grave.remove(g[i]);
|
||||
|
||||
@@ -7923,7 +7923,7 @@ public class CardFactory_Creatures {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
if(card.getOwner().equals(Constant.Player.Human)) humanResolve();
|
||||
if(card.getController().equals(Constant.Player.Human)) humanResolve();
|
||||
else computerResolve();
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +302,31 @@ public class CombatUtil {
|
||||
return true;
|
||||
}//canAttack()
|
||||
|
||||
public static int getTotalFirstStrikeAttackPower(Card attacker, String player)
|
||||
{
|
||||
final Card att = attacker;
|
||||
int i = 0;
|
||||
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(player);
|
||||
list = list.filter(new CardListFilter()
|
||||
{
|
||||
public boolean addCard(Card c)
|
||||
{
|
||||
return c.isUntapped() && canBlock(att, c) && (c.hasFirstStrike() || c.hasDoubleStrike() ) ;
|
||||
}
|
||||
});
|
||||
|
||||
for (Card c:list)
|
||||
{
|
||||
if (!isDoranInPlay())
|
||||
i+= c.getNetAttack();
|
||||
else
|
||||
i+= c.getNetDefense();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
public static boolean canDestroyAttacker(Card attacker, Card defender) {
|
||||
|
||||
if(attacker.getName().equals("Sylvan Basilisk")) return false;
|
||||
|
||||
@@ -228,20 +228,25 @@ import java.util.*;
|
||||
for(; i < attackers.size(); i++)
|
||||
{
|
||||
|
||||
bigAtt = getBiggestAttack(attackers.get(i));
|
||||
bigDef = getBiggestDefense(attackers.get(i));
|
||||
bigAtt = getBiggestAttack(attackers.get(i));
|
||||
bigDef = getBiggestDefense(attackers.get(i));
|
||||
|
||||
/*
|
||||
System.out.println("bigDef: " + bigDef.getName());
|
||||
System.out.println("attackers.get(i): " + attackers.get(i).getName());
|
||||
if (CombatUtil.canDestroyBlocker(bigDef, attackers.get(i)))
|
||||
System.out.println(attackers.get(i).getName() + " can destroy blocker " +bigDef.getName());
|
||||
*/
|
||||
/*
|
||||
System.out.println("bigDef: " + bigDef.getName());
|
||||
System.out.println("attackers.get(i): " + attackers.get(i).getName());
|
||||
if (CombatUtil.canDestroyBlocker(bigDef, attackers.get(i)))
|
||||
System.out.println(attackers.get(i).getName() + " can destroy blocker " +bigDef.getName());
|
||||
*/
|
||||
|
||||
int totalFirstStrikeAttackPower = 0;
|
||||
if (!attackers.get(i).hasFirstStrike() && !attackers.get(i).hasDoubleStrike())
|
||||
totalFirstStrikeAttackPower = CombatUtil.getTotalFirstStrikeAttackPower(attackers.get(i), Constant.Player.Human);
|
||||
|
||||
//if attacker can destroy biggest blocker or
|
||||
//biggest blocker cannot destroy attacker
|
||||
if(CombatUtil.canDestroyBlocker(bigDef, attackers.get(i)) ||
|
||||
(! CombatUtil.canDestroyAttacker(attackers.get(i), bigAtt))){
|
||||
if ( (CombatUtil.canDestroyBlocker(bigDef, attackers.get(i)) ||
|
||||
(! CombatUtil.canDestroyAttacker(attackers.get(i), bigAtt))) &&
|
||||
totalFirstStrikeAttackPower < attackers.get(i).getNetDefense() ){
|
||||
combat.addAttacker(attackers.get(i));
|
||||
}
|
||||
else if(attackers.get(i).getSacrificeAtEOT()){
|
||||
@@ -264,8 +269,6 @@ import java.util.*;
|
||||
return AllZone.CardFactory.getCard("Birds of Paradise", "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//returns 1/1 Card if no blockers found
|
||||
public Card getBiggestDefense(Card attack)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user