mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Moved some combat code around (check for blocker triggers should only happen once now).
- Equipment should get removed now whenever something is grabbed with Control Magic and other cards.
This commit is contained in:
@@ -4787,6 +4787,8 @@ public class CardFactory implements NewConstants {
|
||||
PlayerZone from = AllZone.getZone(c);
|
||||
PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||
|
||||
CardFactoryUtil.checkEquipmentOnControllerChange(from, to, c);
|
||||
|
||||
from.remove(c);
|
||||
to.add(c);
|
||||
|
||||
@@ -6353,6 +6355,7 @@ public class CardFactory implements NewConstants {
|
||||
|
||||
//moveTo() makes a new card, so you don't have to remove "Haste"
|
||||
//AllZone.GameAction.moveTo(playEOT[0], target[0]);
|
||||
|
||||
temp[0].remove(target[0]);
|
||||
orig[0].add(target[0]);
|
||||
target[0].untap();
|
||||
@@ -6385,6 +6388,8 @@ public class CardFactory implements NewConstants {
|
||||
temp[0] = play;
|
||||
orig[0].remove(getTargetCard());
|
||||
|
||||
CardFactoryUtil.checkEquipmentOnControllerChange(orig[0], temp[0], getTargetCard());
|
||||
|
||||
((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(true);
|
||||
((PlayerZone_ComesIntoPlay) AllZone.Computer_Play).setTriggers(true);
|
||||
|
||||
@@ -16101,6 +16106,7 @@ public class CardFactory implements NewConstants {
|
||||
|
||||
PlayerZone to = AllZone.getZone(Constant.Zone.Play,
|
||||
AllZone.GameAction.getOpponent(card.getController()));
|
||||
CardFactoryUtil.checkEquipmentOnControllerChange(from, to, c);
|
||||
to.add(c);
|
||||
|
||||
((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(true);
|
||||
|
||||
@@ -3047,7 +3047,6 @@ public class CardFactoryUtil {
|
||||
list.add(ability);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -3065,6 +3064,16 @@ public class CardFactoryUtil {
|
||||
return neededDamage;
|
||||
}
|
||||
|
||||
public static void checkEquipmentOnControllerChange(PlayerZone from, PlayerZone to, Card c)
|
||||
{
|
||||
if (!c.isEquipped())
|
||||
;
|
||||
else if (!from.equals(to))
|
||||
{
|
||||
c.unEquipAllCards();
|
||||
}
|
||||
}
|
||||
|
||||
//may return null
|
||||
static public Card getRandomCard(CardList list) {
|
||||
if(list.size() == 0) return null;
|
||||
|
||||
@@ -2849,6 +2849,8 @@ class CardFactory_Auras {
|
||||
PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||
to.add(crd);
|
||||
|
||||
CardFactoryUtil.checkEquipmentOnControllerChange(from, to, crd);
|
||||
|
||||
((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(true);
|
||||
((PlayerZone_ComesIntoPlay) AllZone.Computer_Play).setTriggers(true);
|
||||
}
|
||||
@@ -2881,6 +2883,7 @@ class CardFactory_Auras {
|
||||
crd.setController(opp);
|
||||
|
||||
PlayerZone to = AllZone.getZone(Constant.Zone.Play, opp);
|
||||
CardFactoryUtil.checkEquipmentOnControllerChange(from, to, crd);
|
||||
to.add(crd);
|
||||
|
||||
((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(true);
|
||||
|
||||
@@ -7765,6 +7765,7 @@ public class CardFactory_Creatures {
|
||||
from.remove(c);
|
||||
|
||||
PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||
CardFactoryUtil.checkEquipmentOnControllerChange(from, to, c);
|
||||
to.add(c);
|
||||
|
||||
((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(true);
|
||||
|
||||
@@ -165,7 +165,7 @@ public class Combat
|
||||
{
|
||||
blocked.add(attacker);
|
||||
getList(attacker).add(blocker);
|
||||
CombatUtil.checkBlockedAttackers(attacker, blocker);
|
||||
//CombatUtil.checkBlockedAttackers(attacker, blocker);
|
||||
}
|
||||
public void resetBlockers()
|
||||
{
|
||||
|
||||
@@ -418,7 +418,7 @@ public class CombatUtil {
|
||||
|
||||
//loop through blockers
|
||||
for(int inner = 0; inner < defend.length; inner++) {
|
||||
checkDeclareBlockers(defend[inner]);
|
||||
//checkDeclareBlockers(defend[inner]);
|
||||
blockerName = defend[inner].getName();
|
||||
if(defend[inner].isFaceDown()) blockerName = "Morph";
|
||||
|
||||
@@ -469,7 +469,7 @@ public class CombatUtil {
|
||||
|
||||
//loop through blockers
|
||||
for(int inner = 0; inner < defend.length; inner++) {
|
||||
checkDeclareBlockers(defend[inner]);
|
||||
//checkDeclareBlockers(defend[inner]);
|
||||
blockerName = defend[inner].getName();
|
||||
if(defend[inner].isFaceDown()) blockerName = "Morph";
|
||||
|
||||
@@ -1444,7 +1444,7 @@ public class CombatUtil {
|
||||
|
||||
}
|
||||
|
||||
private static void checkDeclareBlockers(Card c) {
|
||||
static void checkDeclareBlockers(Card c) {
|
||||
if(AllZone.Phase.getPhase().equals("Declare Blockers")) {
|
||||
|
||||
if(c.getName().equals("Jedit Ojanen of Efrava") && !c.getCreatureBlockedThisTurn()) {
|
||||
@@ -1509,9 +1509,11 @@ public class CombatUtil {
|
||||
for(Ability ab:CardFactoryUtil.getBushidoEffects(a))
|
||||
AllZone.Stack.add(ab);
|
||||
}
|
||||
|
||||
if (!b.getCreatureBlockedThisTurn()) {
|
||||
for(Ability ab:CardFactoryUtil.getBushidoEffects(b))
|
||||
AllZone.Stack.add(ab);
|
||||
b.setCreatureBlockedThisTurn(true);
|
||||
}
|
||||
|
||||
if(a.getKeyword().contains("Flanking") && !b.getKeyword().contains("Flanking")) {
|
||||
int flankingMagnitude = 0;
|
||||
|
||||
@@ -9,6 +9,7 @@ public interface Computer
|
||||
public void declare_attackers();
|
||||
public void declare_blockers();//this is called after when the Human or Computer blocks
|
||||
public void declare_blockers_after();//can play Instants and Abilities
|
||||
public void after_declare_blockers();
|
||||
public void end_of_combat();
|
||||
public void main2();
|
||||
public void end_of_turn();//end of Human's turn
|
||||
|
||||
@@ -88,6 +88,11 @@ public class ComputerAI_Burn implements Computer {
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void after_declare_blockers()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void end_of_combat()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
|
||||
@@ -125,6 +125,11 @@ public class ComputerAI_Burn2 implements Computer {
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void after_declare_blockers()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void end_of_combat()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
|
||||
@@ -287,6 +287,29 @@ public class ComputerAI_General implements Computer {
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void after_declare_blockers() {
|
||||
CardList list = new CardList();
|
||||
list.addAll(AllZone.Combat.getAllBlockers().toArray());
|
||||
list.addAll(AllZone.pwCombat.getAllBlockers().toArray());
|
||||
|
||||
CardList attList = new CardList();
|
||||
attList.addAll(AllZone.Combat.getAttackers());
|
||||
attList.addAll(AllZone.pwCombat.getAttackers());
|
||||
|
||||
|
||||
for(Card c:list)
|
||||
CombatUtil.checkDeclareBlockers(c);
|
||||
|
||||
|
||||
for (Card a:attList){
|
||||
CardList blockList = AllZone.Combat.getBlockers(a);
|
||||
for (Card b:blockList)
|
||||
CombatUtil.checkBlockedAttackers(a, b);
|
||||
}
|
||||
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void end_of_combat()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
|
||||
@@ -46,6 +46,9 @@ public class ComputerAI_Input extends Input {
|
||||
computer.declare_attackers();
|
||||
} else if(phase.equals(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
|
||||
computer.declare_blockers_after();
|
||||
} else if (phase.equals(Constant.Phase.Combat_After_Declare_Blockers))
|
||||
{
|
||||
computer.after_declare_blockers();
|
||||
} else if(phase.equals(Constant.Phase.Main2)) {
|
||||
computer.main2();
|
||||
} else if(phase.equals(Constant.Phase.At_End_Of_Turn)) {
|
||||
|
||||
@@ -123,6 +123,11 @@ public class ComputerAI_Rats2 implements Computer
|
||||
|
||||
public void declare_blockers_after(){playInstantAndAbilities();}
|
||||
|
||||
public void after_declare_blockers()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void end_of_combat()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
|
||||
@@ -45,6 +45,11 @@ public class ComputerAI_Testing implements Computer
|
||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Testing.declare_blockers_after) = true");
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void after_declare_blockers()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void end_of_combat()
|
||||
{
|
||||
|
||||
@@ -65,6 +65,7 @@ public interface Constant {
|
||||
public static final String Combat_Declare_Attackers_InstantAbility = "Declare Attackers - Play Instants and Abilities";
|
||||
public static final String Combat_Declare_Attackers = "Declare Attackers";
|
||||
public static final String Combat_Declare_Blockers = "Declare Blockers";
|
||||
public static final String Combat_After_Declare_Blockers = "After Declare Blockers Phase";
|
||||
public static final String Combat_Declare_Blockers_InstantAbility = "Declare Blockers - Play Instants and Abilities";
|
||||
public static final String Combat_Damage = "Combat Damage";
|
||||
public static final String Combat_FirstStrikeDamage = "First Strike Damage";
|
||||
|
||||
@@ -114,7 +114,34 @@ public class InputControl extends MyObservable implements java.io.Serializable {
|
||||
//do not return getInput() here. There is now a check for null by this method's caller.
|
||||
return null;
|
||||
}
|
||||
} else if(phase.equals(Constant.Phase.Combat_FirstStrikeDamage)) {
|
||||
}
|
||||
/*
|
||||
else if (phase.equals(Constant.Phase.Combat_After_Declare_Blockers))
|
||||
{
|
||||
CardList list = new CardList();
|
||||
list.addAll(AllZone.Combat.getAllBlockers().toArray());
|
||||
list.addAll(AllZone.pwCombat.getAllBlockers().toArray());
|
||||
|
||||
CardList attList = new CardList();
|
||||
attList.addAll(AllZone.Combat.getAttackers());
|
||||
attList.addAll(AllZone.pwCombat.getAttackers());
|
||||
|
||||
|
||||
for(Card c:list)
|
||||
CombatUtil.checkDeclareBlockers(c);
|
||||
|
||||
|
||||
for (Card a:attList){
|
||||
CardList blockList = AllZone.Combat.getBlockers(a);
|
||||
for (Card b:blockList)
|
||||
CombatUtil.checkBlockedAttackers(a, b);
|
||||
}
|
||||
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
*/
|
||||
|
||||
else if(phase.equals(Constant.Phase.Combat_FirstStrikeDamage)) {
|
||||
if(!skipPhase()) return new Input_FirstStrikeDamage();
|
||||
else {
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public class Phase extends MyObservable {
|
||||
{Constant.Player.Computer, Constant.Phase.Combat_Declare_Blockers},
|
||||
{Constant.Player.Human, Constant.Phase.Combat_Declare_Blockers_InstantAbility},
|
||||
{Constant.Player.Computer, Constant.Phase.Combat_Declare_Blockers_InstantAbility},
|
||||
{Constant.Player.Computer, Constant.Phase.Combat_After_Declare_Blockers},
|
||||
{Constant.Player.Human, Constant.Phase.Combat_FirstStrikeDamage}, //TODO: need to allow computer to have priority (play instants and abilities).
|
||||
{Constant.Player.Human, Constant.Phase.Combat_Damage},
|
||||
{Constant.Player.Human, Constant.Phase.End_Of_Combat},
|
||||
@@ -42,6 +43,7 @@ public class Phase extends MyObservable {
|
||||
{Constant.Player.Human, Constant.Phase.Combat_Declare_Blockers},
|
||||
{Constant.Player.Computer, Constant.Phase.Combat_Declare_Blockers_InstantAbility},
|
||||
{Constant.Player.Human, Constant.Phase.Combat_Declare_Blockers_InstantAbility},
|
||||
{Constant.Player.Computer, Constant.Phase.Combat_After_Declare_Blockers},
|
||||
{Constant.Player.Human, Constant.Phase.Combat_FirstStrikeDamage}, //TODO: need to allow computer to have priority (play instants and abilities).
|
||||
{Constant.Player.Human, Constant.Phase.Combat_Damage},
|
||||
{Constant.Player.Human, Constant.Phase.End_Of_Combat},
|
||||
|
||||
Reference in New Issue
Block a user