mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Improved Slapshot's Phase shortcut to handle Ranges to help clean up Phase Restrictions
- Converted Arcum's Sleigh and Reset
This commit is contained in:
@@ -493,25 +493,18 @@ public class AbilityFactory {
|
||||
|
||||
if (mapParams.containsKey("ActivatingPhases")) {
|
||||
String phases = mapParams.get("ActivatingPhases");
|
||||
if(phases.equals("AfterUpkeep")) {
|
||||
String newPhase = "";
|
||||
newPhase = newPhase + Constant.Phase.Draw +",";
|
||||
newPhase = newPhase + Constant.Phase.Main1 +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_Begin +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_Declare_Attackers +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_Declare_Attackers_InstantAbility +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_Declare_Blockers +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_Declare_Blockers_InstantAbility +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_Damage +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_FirstStrikeDamage +",";
|
||||
newPhase = newPhase + Constant.Phase.Combat_End +",";
|
||||
newPhase = newPhase + Constant.Phase.Main2 +",";
|
||||
newPhase = newPhase + Constant.Phase.End_Of_Turn +",";
|
||||
newPhase = newPhase + Constant.Phase.Cleanup;
|
||||
|
||||
if (phases.contains("->")){
|
||||
// If phases lists a Range, split and Build Activate String
|
||||
// Combat_Begin->Combat_End (During Combat)
|
||||
// Draw-> (After Upkeep)
|
||||
// Upkeep->Combat_Begin (Before Declare Attackers)
|
||||
|
||||
restrict.setActivatePhases(newPhase);
|
||||
String[] split = phases.split("->", 2);
|
||||
phases = AllZone.Phase.buildActivateString(split[0], split[1]);
|
||||
}
|
||||
else restrict.setActivatePhases(phases);
|
||||
|
||||
restrict.setActivatePhases(phases);
|
||||
}
|
||||
|
||||
if (mapParams.containsKey("ActivatingCardsInHand"))
|
||||
|
||||
@@ -23,9 +23,11 @@ public class AllZone implements NewConstants {
|
||||
public static EndOfTurn EndOfTurn = new EndOfTurn();
|
||||
public static EndOfCombat EndOfCombat = new EndOfCombat();
|
||||
|
||||
public static final Phase Phase = new Phase();
|
||||
|
||||
// Phase is now a prerequisite for CardFactory
|
||||
public static final CardFactory CardFactory = new CardFactory(ForgeProps.getFile(CARDSFOLDER));
|
||||
|
||||
public static final Phase Phase = new Phase();
|
||||
public static final MagicStack Stack = new MagicStack();
|
||||
public static final InputControl InputControl = new InputControl();
|
||||
public static final GameAction GameAction = new GameAction();
|
||||
|
||||
@@ -606,6 +606,27 @@ public class Phase extends MyObservable
|
||||
AllZone.Phase.getPhase().equals(Constant.Phase.Main1)) && AllZone.Stack.size() == 0;
|
||||
}
|
||||
|
||||
public String buildActivateString(String startPhase, String endPhase){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
boolean add = false;
|
||||
for(int i = 0; i < phaseOrder.length; i++){
|
||||
if (phaseOrder[i].equals(startPhase))
|
||||
add = true;
|
||||
|
||||
if (add){
|
||||
if (sb.length() != 0)
|
||||
sb.append(",");
|
||||
sb.append(phaseOrder[i]);
|
||||
}
|
||||
|
||||
if (phaseOrder[i].equals(endPhase))
|
||||
add = false;
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean canPlayDuringCombat() {
|
||||
String phase = AllZone.Phase.getPhase();
|
||||
ArrayList<String> validPhases = new ArrayList<String>();
|
||||
@@ -620,13 +641,7 @@ public class Phase extends MyObservable
|
||||
|
||||
return validPhases.contains(phase);
|
||||
}
|
||||
|
||||
public static boolean canPlayAfterUpkeep() {
|
||||
String phase = AllZone.Phase.getPhase();
|
||||
|
||||
return !phase.equals(Constant.Phase.Upkeep);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String args[]) {
|
||||
Phase phase = new Phase();
|
||||
for(int i = 0; i < phase.phaseOrder.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user