mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Convert abLoseLife to use Ability Cost and Target.
- Cleanup in PlayerLife - Added Necrogen Censer
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -2617,6 +2617,7 @@ res/cardsfolder/naya_battlemage.txt -text svneol=native#text/plain
|
|||||||
res/cardsfolder/naya_hushblade.txt -text svneol=native#text/plain
|
res/cardsfolder/naya_hushblade.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/near_death_experience.txt -text svneol=native#text/plain
|
res/cardsfolder/near_death_experience.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/neck_snap.txt -text svneol=native#text/plain
|
res/cardsfolder/neck_snap.txt -text svneol=native#text/plain
|
||||||
|
res/cardsfolder/necrogen_censer.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/necrogen_spellbomb.txt -text svneol=native#text/plain
|
res/cardsfolder/necrogen_spellbomb.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/necrogenesis.txt -text svneol=native#text/plain
|
res/cardsfolder/necrogenesis.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/necropotence.txt -text svneol=native#text/plain
|
res/cardsfolder/necropotence.txt -text svneol=native#text/plain
|
||||||
|
|||||||
9
res/cardsfolder/necrogen_censer.txt
Normal file
9
res/cardsfolder/necrogen_censer.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Name:Necrogen Censer
|
||||||
|
ManaCost:3
|
||||||
|
Types:Artifact
|
||||||
|
Text:no text
|
||||||
|
K:etbCounter:CHARGE:2
|
||||||
|
K:abLoseLifeTgt T SubCounter<1/CHARGE>:2
|
||||||
|
SVar:Rarity:Common
|
||||||
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/necrogen_censer.jpg
|
||||||
|
End
|
||||||
@@ -4120,6 +4120,7 @@ public class CardFactory implements NewConstants {
|
|||||||
|
|
||||||
if (hasKeyword(card, "abLoseLife") != -1)
|
if (hasKeyword(card, "abLoseLife") != -1)
|
||||||
{
|
{
|
||||||
|
// abLoseLife{Tgt} <abCost>:<lifeLoss>:{Drawback$<Drawback>}:<SADesc>:<StackDesc>
|
||||||
int n = hasKeyword(card, "abLoseLife");
|
int n = hasKeyword(card, "abLoseLife");
|
||||||
if (n != -1)
|
if (n != -1)
|
||||||
{
|
{
|
||||||
@@ -4127,36 +4128,30 @@ public class CardFactory implements NewConstants {
|
|||||||
card.removeIntrinsicKeyword(parse);
|
card.removeIntrinsicKeyword(parse);
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
String k[] = parse.split(":");
|
||||||
|
String tmp = k[0].replace("abLoseLife", "");
|
||||||
|
|
||||||
final boolean Tgt[] = {false};
|
String[] tmpCost = tmp.split(" ", 2);
|
||||||
Tgt[0] = k[0].contains("Tgt");
|
|
||||||
|
|
||||||
String tmpCost = "";
|
int inc = 0;
|
||||||
|
|
||||||
if (Tgt[0])
|
final Target abTgt;
|
||||||
tmpCost = k[0].substring(13);
|
if (tmpCost[0].equals(""))
|
||||||
else
|
abTgt = null;
|
||||||
tmpCost = k[0].substring(10);
|
else{
|
||||||
|
abTgt = new Target(tmpCost[0]+"V");
|
||||||
boolean tapCost = false;
|
abTgt.setValidTgts("player".split(","));
|
||||||
boolean tapOnlyCost = false;
|
abTgt.setVTSelection("Target a player to lose life");
|
||||||
|
|
||||||
if (tmpCost.contains("T"))
|
|
||||||
{
|
|
||||||
tapCost = true;
|
|
||||||
tmpCost = tmpCost.replace("T", "").trim();
|
|
||||||
if (tmpCost.length() == 0)
|
|
||||||
tapOnlyCost = true;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
tmpCost = tmpCost.trim();
|
|
||||||
|
|
||||||
final String manaCost = tmpCost;
|
final Ability_Cost abCost = new Ability_Cost(tmpCost[1], card.getName(), true);
|
||||||
|
|
||||||
final int NumLife[] = {-1};
|
final int NumLife[] = {-1};
|
||||||
final String NumLifeX[] = {"none"};
|
final String NumLifeX[] = {"none"};
|
||||||
|
|
||||||
if (k[1].matches("X"))
|
int lifePos = 1;
|
||||||
|
int drawbackPos = 2;
|
||||||
|
|
||||||
|
if (k[lifePos].matches("X"))
|
||||||
{
|
{
|
||||||
String x = card.getSVar(k[1]);
|
String x = card.getSVar(k[1]);
|
||||||
if (x.startsWith("Count$"))
|
if (x.startsWith("Count$"))
|
||||||
@@ -4165,35 +4160,35 @@ public class CardFactory implements NewConstants {
|
|||||||
NumLifeX[0] = kk[1];
|
NumLifeX[0] = kk[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (k[1].matches("[0-9][0-9]?"))
|
else if (k[lifePos].matches("[0-9][0-9]?"))
|
||||||
NumLife[0] = Integer.parseInt(k[1]);
|
NumLife[0] = Integer.parseInt(k[1]);
|
||||||
|
|
||||||
// drawbacks and descriptions
|
// drawbacks and descriptions
|
||||||
final String DrawBack[] = {"none"};
|
final String DrawBack[] = {"none"};
|
||||||
final String spDesc[] = {"none"};
|
final String spDesc[] = {"none"};
|
||||||
final String stDesc[] = {"none"};
|
final String stDesc[] = {"none"};
|
||||||
if (k.length > 2)
|
if (k.length > drawbackPos)
|
||||||
{
|
{
|
||||||
if (k[2].contains("Drawback$"))
|
if (k[drawbackPos].contains("Drawback$"))
|
||||||
{
|
{
|
||||||
String kk[] = k[2].split("\\$");
|
String kk[] = k[drawbackPos].split("\\$");
|
||||||
DrawBack[0] = kk[1];
|
DrawBack[0] = kk[1];
|
||||||
if (k.length > 3)
|
if (k.length > drawbackPos+1)
|
||||||
spDesc[0] = k[3];
|
spDesc[0] = k[drawbackPos+1];
|
||||||
if (k.length > 4)
|
if (k.length > drawbackPos+2)
|
||||||
stDesc[0] = k[4];
|
stDesc[0] = k[drawbackPos+2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (k.length > 2)
|
if (k.length > drawbackPos)
|
||||||
spDesc[0] = k[2];
|
spDesc[0] = k[drawbackPos];
|
||||||
if (k.length > 3)
|
if (k.length > drawbackPos+1)
|
||||||
stDesc[0] = k[3];
|
stDesc[0] = k[drawbackPos+1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Tgt[0] == true)
|
if (abTgt != null)
|
||||||
{
|
{
|
||||||
spDesc[0] = "Target player loses " + NumLife[0] + " life.";
|
spDesc[0] = "Target player loses " + NumLife[0] + " life.";
|
||||||
stDesc[0] = cardName + " - target player loses life";
|
stDesc[0] = cardName + " - target player loses life";
|
||||||
@@ -4204,138 +4199,75 @@ public class CardFactory implements NewConstants {
|
|||||||
stDesc[0] = cardName + " - you lose life";
|
stDesc[0] = cardName + " - you lose life";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tapCost)
|
|
||||||
|
final SpellAbility abLoseLife = new Ability_Activated(card, abCost.getMana())
|
||||||
{
|
{
|
||||||
final SpellAbility abLoseLife = new Ability_Activated(card, manaCost)
|
private static final long serialVersionUID = -936369754466156082L;
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -936369754466156082L;
|
public int getNumLife()
|
||||||
|
{
|
||||||
public int getNumLife()
|
if (NumLife[0] != -1)
|
||||||
{
|
return NumLife[0];
|
||||||
if (NumLife[0] != -1)
|
|
||||||
return NumLife[0];
|
if (! NumLifeX[0].equals("none"))
|
||||||
|
return CardFactoryUtil.xCount(card, NumLifeX[0]);
|
||||||
if (! NumLifeX[0].equals("none"))
|
|
||||||
return CardFactoryUtil.xCount(card, NumLifeX[0]);
|
return 0;
|
||||||
|
}
|
||||||
return 0;
|
|
||||||
}
|
public boolean canPlayAI()
|
||||||
|
{
|
||||||
public boolean canPlayAI()
|
int nlife = getNumLife();
|
||||||
{
|
int life = AllZone.GameAction.getPlayerLife(Constant.Player.Human).getLife();
|
||||||
Random r = new Random();
|
if (abCost.getSacCost() && life > nlife + 4) return false;
|
||||||
boolean rr = false; // prevent run-away activations - first time will always return true
|
if (abCost.getSubCounter() && life > nlife + 6) return false;
|
||||||
if (r.nextFloat() <= Math.pow(.6667, card.getAbilityUsed()))
|
if (abCost.getLifeCost() && life >= AllZone.GameAction.getPlayerLife(Constant.Player.Computer).getLife())
|
||||||
rr = true;
|
return false;
|
||||||
|
|
||||||
if (Tgt[0] == true)
|
Random r = new Random();
|
||||||
{
|
boolean rr = false; // prevent run-away activations - first time will always return true
|
||||||
setTargetPlayer(Constant.Player.Human);
|
if (r.nextFloat() <= Math.pow(.6667, card.getAbilityUsed()))
|
||||||
return true && rr;
|
rr = true;
|
||||||
}
|
|
||||||
else
|
if (abTgt != null)
|
||||||
{ // assumes there's a good Drawback$ that makes losing life worth it
|
{
|
||||||
int nlife = getNumLife();
|
setTargetPlayer(Constant.Player.Human);
|
||||||
if ((AllZone.Computer_Life.getLife() - nlife) >= 10)
|
return true && rr;
|
||||||
return true && rr;
|
}
|
||||||
else
|
else
|
||||||
return false;
|
{ // assumes there's a good Drawback$ that makes losing life worth it
|
||||||
}
|
if ((AllZone.Computer_Life.getLife() - nlife) >= 10)
|
||||||
}
|
return true && rr;
|
||||||
|
else
|
||||||
public void resolve()
|
return false;
|
||||||
{
|
}
|
||||||
int nlife = getNumLife();
|
}
|
||||||
String TgtPlayer;
|
|
||||||
|
public void resolve()
|
||||||
if (Tgt[0] == true)
|
{
|
||||||
TgtPlayer = getTargetPlayer();
|
int nlife = getNumLife();
|
||||||
else
|
String TgtPlayer;
|
||||||
TgtPlayer = card.getController();
|
|
||||||
|
if (abTgt != null)
|
||||||
AllZone.GameAction.getPlayerLife(TgtPlayer).subtractLife(nlife,card);
|
TgtPlayer = getTargetPlayer();
|
||||||
|
else
|
||||||
if (!DrawBack[0].equals("none"))
|
TgtPlayer = card.getController();
|
||||||
CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null, this);
|
|
||||||
}//resolve()
|
AllZone.GameAction.getPlayerLife(TgtPlayer).subtractLife(nlife,card);
|
||||||
};//SpellAbility
|
|
||||||
|
if (!DrawBack[0].equals("none"))
|
||||||
if (Tgt[0] == true)
|
CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null, this);
|
||||||
abLoseLife.setBeforePayMana(CardFactoryUtil.input_targetPlayer(abLoseLife));
|
}//resolve()
|
||||||
|
};//SpellAbility
|
||||||
abLoseLife.setDescription(manaCost + ": " + spDesc[0]);
|
|
||||||
abLoseLife.setStackDescription(stDesc[0]);
|
if (abTgt != null)
|
||||||
|
abLoseLife.setTarget(abTgt);
|
||||||
card.addSpellAbility(abLoseLife);
|
|
||||||
}
|
abLoseLife.setPayCosts(abCost);
|
||||||
else
|
abLoseLife.setDescription(abCost.toString() + spDesc[0]);
|
||||||
{
|
abLoseLife.setStackDescription(stDesc[0]);
|
||||||
final SpellAbility abLoseLife = new Ability_Tap(card)
|
|
||||||
{
|
card.addSpellAbility(abLoseLife);
|
||||||
private static final long serialVersionUID = -3661692584660594012L;
|
|
||||||
|
|
||||||
public int getNumLife()
|
|
||||||
{
|
|
||||||
if (NumLife[0] != -1)
|
|
||||||
return NumLife[0];
|
|
||||||
|
|
||||||
if (! NumLifeX[0].equals("none"))
|
|
||||||
return CardFactoryUtil.xCount(card, NumLifeX[0]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
boolean att = !CardFactoryUtil.AI_doesCreatureAttack(card);
|
|
||||||
|
|
||||||
if (Tgt[0] == true)
|
|
||||||
{
|
|
||||||
setTargetPlayer(Constant.Player.Human);
|
|
||||||
return true && att;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // assumes there's a good Drawback$ that makes losing life worth it
|
|
||||||
int nlife = getNumLife();
|
|
||||||
if ((AllZone.Computer_Life.getLife() - nlife) >= 10)
|
|
||||||
return true && att;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
int nlife = getNumLife();
|
|
||||||
String TgtPlayer;
|
|
||||||
|
|
||||||
if (Tgt[0] == true)
|
|
||||||
TgtPlayer = getTargetPlayer();
|
|
||||||
else
|
|
||||||
TgtPlayer = card.getController();
|
|
||||||
|
|
||||||
AllZone.GameAction.getPlayerLife(TgtPlayer).subtractLife(nlife,card);
|
|
||||||
|
|
||||||
if (!DrawBack[0].equals("none"))
|
|
||||||
CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null, this);
|
|
||||||
}//resolve()
|
|
||||||
};//SpellAbility
|
|
||||||
|
|
||||||
if (Tgt[0] == true)
|
|
||||||
abLoseLife.setBeforePayMana(CardFactoryUtil.input_targetPlayer(abLoseLife));
|
|
||||||
|
|
||||||
if (tapOnlyCost)
|
|
||||||
abLoseLife.setDescription("Tap: " + spDesc[0]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
abLoseLife.setDescription(manaCost + ", tap: " + spDesc[0]);
|
|
||||||
abLoseLife.setManaCost(manaCost);
|
|
||||||
}
|
|
||||||
|
|
||||||
abLoseLife.setStackDescription(stDesc[0]);
|
|
||||||
|
|
||||||
card.addSpellAbility(abLoseLife);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}// abLoseLife
|
}// abLoseLife
|
||||||
|
|
||||||
@@ -4623,7 +4555,7 @@ public class CardFactory implements NewConstants {
|
|||||||
card.addSpellAbility(abGainLife);
|
card.addSpellAbility(abGainLife);
|
||||||
}
|
}
|
||||||
}// abGainLife
|
}// abGainLife
|
||||||
|
|
||||||
|
|
||||||
if(hasKeyword(card, "SearchRebel") != -1) {
|
if(hasKeyword(card, "SearchRebel") != -1) {
|
||||||
int n = hasKeyword(card, "SearchRebel");
|
int n = hasKeyword(card, "SearchRebel");
|
||||||
|
|||||||
@@ -40,19 +40,11 @@ public class PlayerLife extends MyObservable implements java.io.Serializable
|
|||||||
public void subtractLife(int life2, Card SourceCard)
|
public void subtractLife(int life2, Card SourceCard)
|
||||||
{
|
{
|
||||||
life -= life2;
|
life -= life2;
|
||||||
//unnecessary (I think?), since the addDamage methods in GameAction already check this:
|
|
||||||
/*
|
|
||||||
Object[] DealsDamage_Whenever_Parameters = new Object[3];
|
|
||||||
DealsDamage_Whenever_Parameters[0] = player;
|
|
||||||
DealsDamage_Whenever_Parameters[2] = SourceCard;
|
|
||||||
AllZone.GameAction.CheckWheneverKeyword(playerCard, "DealsDamage", DealsDamage_Whenever_Parameters);
|
|
||||||
*/
|
|
||||||
this.updateObservers();
|
this.updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void payLife(int life2) // change this to subtractLife
|
public void payLife(int life2) // change this to subtractLife
|
||||||
{
|
{
|
||||||
life -= life2;
|
subtractLife(life2, null);
|
||||||
this.updateObservers();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user