mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Added activatingPlayer to SpellAbility.
- Rakka Mar and Captain of the Watch now use the activatingPlayer which is locked in when the ability hits the stack.
This commit is contained in:
@@ -3798,13 +3798,6 @@ public class CardFactoryUtil {
|
||||
return s;
|
||||
}
|
||||
|
||||
public static boolean hasNecropotence(String player) {
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
|
||||
CardList list = new CardList(play.getCards());
|
||||
list = list.getName("Necropotence");
|
||||
return list.size() > 0;
|
||||
}
|
||||
|
||||
public static CardList getCards(String cardName)
|
||||
{
|
||||
CardList list = new CardList();
|
||||
@@ -3905,6 +3898,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
public static CardList makeToken(String name, String imageName, Card source, String manaCost, String[] types, int baseAttack, int baseDefense, String[] intrinsicKeywords) {
|
||||
// todo(sol) this function shouldn't be called, better to call makeToken with String controller as third paramter
|
||||
CardList list = new CardList();
|
||||
Card c = new Card();
|
||||
c.setName(name);
|
||||
@@ -3935,12 +3929,11 @@ public class CardFactoryUtil {
|
||||
Card temp = CardFactory.copyStats(c);
|
||||
temp.setToken(true);
|
||||
temp.setController(source.getController());
|
||||
temp.setOwner(source.getOwner());
|
||||
temp.setOwner(source.getController());
|
||||
play.add(temp);
|
||||
list.add(temp);
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public static CardList makeToken(String name, String imageName, String controller, String manaCost, String[] types, int baseAttack, int baseDefense, String[] intrinsicKeywords) {
|
||||
|
||||
@@ -189,7 +189,7 @@ public class CardFactory_Creatures {
|
||||
}//resolve()
|
||||
|
||||
public void makeToken() {
|
||||
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", card, "W", new String[] {
|
||||
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", getActivatingPlayer(), "W", new String[] {
|
||||
"Creature", "Soldier"}, 1, 1, new String[] {""});
|
||||
}
|
||||
|
||||
@@ -14076,7 +14076,7 @@ public class CardFactory_Creatures {
|
||||
}
|
||||
|
||||
void makeToken() {
|
||||
CardFactoryUtil.makeToken("Elemental", "R 3 1 Elemental", card, "R", new String[] {
|
||||
CardFactoryUtil.makeToken("Elemental", "R 3 1 Elemental", getActivatingPlayer(), "R", new String[] {
|
||||
"Creature", "Elemental"}, 3, 1, new String[] {"Haste"});
|
||||
}//makeToken()
|
||||
};//SpellAbility
|
||||
|
||||
@@ -36,6 +36,7 @@ public class ComputerUtil
|
||||
payManaCost(all[i]);
|
||||
all[i].chooseTargetAI();
|
||||
all[i].getBeforePayManaAI().execute();
|
||||
all[i].setActivatingPlayer(Constant.Player.Computer);
|
||||
AllZone.Stack.add(all[i]);
|
||||
|
||||
return false;
|
||||
@@ -52,6 +53,7 @@ public class ComputerUtil
|
||||
if (AllZone.GameAction.isCardInZone(sa.getSourceCard(),AllZone.Computer_Hand))
|
||||
AllZone.Computer_Hand.remove(sa.getSourceCard());
|
||||
|
||||
sa.setActivatingPlayer(Constant.Player.Computer);
|
||||
|
||||
if (sa.getSourceCard().getKeyword().contains("Draw a card."))
|
||||
AllZone.GameAction.drawCard(sa.getSourceCard().getController());
|
||||
@@ -63,6 +65,8 @@ public class ComputerUtil
|
||||
|
||||
final static public void playStackFree(SpellAbility sa)
|
||||
{
|
||||
sa.setActivatingPlayer(Constant.Player.Computer);
|
||||
|
||||
if (AllZone.GameAction.isCardInZone(sa.getSourceCard(),AllZone.Computer_Hand))
|
||||
AllZone.Computer_Hand.remove(sa.getSourceCard());
|
||||
|
||||
@@ -85,6 +89,8 @@ public class ComputerUtil
|
||||
//sa.getSourceCard().comesIntoPlay(); - messes things up, maybe for the future fix this
|
||||
}
|
||||
|
||||
sa.setActivatingPlayer(Constant.Player.Computer);
|
||||
|
||||
if(sa instanceof Ability_Tap)
|
||||
sa.getSourceCard().tap();
|
||||
|
||||
|
||||
@@ -3238,7 +3238,7 @@ public class GameAction {
|
||||
|
||||
public void playSpellAbility(SpellAbility sa) {
|
||||
ManaCost manaCost = new ManaCost(sa.getManaCost());
|
||||
|
||||
sa.setActivatingPlayer(Constant.Player.Human);
|
||||
if(sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
|
||||
manaCost = new ManaCost("0");
|
||||
} else {
|
||||
|
||||
@@ -80,6 +80,12 @@ public class MagicStack extends MyObservable
|
||||
|
||||
public void add(SpellAbility sp)
|
||||
{
|
||||
// if activating player slips through the cracks, assign activating Player to the controller here
|
||||
if (sp.getActivatingPlayer().equals("")){
|
||||
sp.setActivatingPlayer(sp.getSourceCard().getController());
|
||||
//System.out.println(sp.getSourceCard().getName() + " - activatingPlayer not set before adding to stack.");
|
||||
}
|
||||
|
||||
if(sp instanceof Ability_Mana || sp instanceof Ability_Triggered)//TODO make working triggered abilities!
|
||||
sp.resolve();
|
||||
else {
|
||||
|
||||
@@ -18,6 +18,7 @@ public abstract class SpellAbility {
|
||||
private String additionalManaCost = "";
|
||||
private String multiKickerManaCost= "";
|
||||
private String xManaCost = "";
|
||||
private String activatingPlayer = "";
|
||||
|
||||
private String type = "Intrinsic"; //set to Intrinsic by default
|
||||
|
||||
@@ -129,6 +130,16 @@ public abstract class SpellAbility {
|
||||
xManaCost = cost;
|
||||
}
|
||||
|
||||
public String getActivatingPlayer()
|
||||
{
|
||||
return activatingPlayer;
|
||||
}
|
||||
|
||||
public void setActivatingPlayer(String player)
|
||||
{
|
||||
activatingPlayer = player;
|
||||
}
|
||||
|
||||
public boolean isSpell() {
|
||||
return spell;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user