mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
1) make targeting for AF_DealDamage optional (though almost everything needs it; there's still a warning message displayed to console)
2) convert Stuffy Doll to AF_DealDamage (no target specified) 3) moved code from Filthy Cur, Jackal Pup, Shinka Gatekeeper and Stuffy Doll to the addDamage code in Card.java (previously, it was overriding the addDamage method and putting it on a new card in CardFactory_Creatures.java)
This commit is contained in:
@@ -4,6 +4,7 @@ Types:Artifact Creature Construct
|
|||||||
Text:Whenever damage is dealt to Stuffy Doll, it deals that much damage to your opponent.
|
Text:Whenever damage is dealt to Stuffy Doll, it deals that much damage to your opponent.
|
||||||
PT:0/1
|
PT:0/1
|
||||||
K:Indestructible
|
K:Indestructible
|
||||||
|
A:AB$DealDamage|Cost$T|NumDmg$1|SpellDescription$Stuffy Doll deals 1 damage to itself.
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://resources.wizards.com/magic/cards/tsp/en-us/card116724.jpg
|
SVar:Picture:http://resources.wizards.com/magic/cards/tsp/en-us/card116724.jpg
|
||||||
SetInfo:TSP|Rare|http://magiccards.info/scans/en/ts/264.jpg
|
SetInfo:TSP|Rare|http://magiccards.info/scans/en/ts/264.jpg
|
||||||
|
|||||||
@@ -19,37 +19,37 @@ import java.util.Random;
|
|||||||
|
|
||||||
public Ability_Sub getSubAbility() { return subAbAF; }
|
public Ability_Sub getSubAbility() { return subAbAF; }
|
||||||
|
|
||||||
public AbilityFactory_DealDamage(AbilityFactory newAF)
|
public AbilityFactory_DealDamage(AbilityFactory newAF)
|
||||||
{
|
{
|
||||||
AF = newAF;
|
AF = newAF;
|
||||||
|
|
||||||
damage = AF.getMapParams().get("NumDmg");
|
damage = AF.getMapParams().get("NumDmg");
|
||||||
|
|
||||||
if(AF.getMapParams().containsKey("Tgt"))
|
if(AF.getMapParams().containsKey("Tgt"))
|
||||||
if (AF.getMapParams().get("Tgt").equals("TgtOpp"))
|
if (AF.getMapParams().get("Tgt").equals("TgtOpp"))
|
||||||
TgtOpp = true;
|
TgtOpp = true;
|
||||||
|
|
||||||
if(AF.hasSubAbility())
|
if(AF.hasSubAbility())
|
||||||
{
|
{
|
||||||
String sSub = AF.getMapParams().get("SubAbility");
|
String sSub = AF.getMapParams().get("SubAbility");
|
||||||
|
|
||||||
if (sSub.startsWith("SVar="))
|
if (sSub.startsWith("SVar="))
|
||||||
sSub = AF.getHostCard().getSVar(sSub.split("=")[1]);
|
sSub = AF.getHostCard().getSVar(sSub.split("=")[1]);
|
||||||
|
|
||||||
if (sSub.startsWith("DB$"))
|
if (sSub.startsWith("DB$"))
|
||||||
{
|
{
|
||||||
AbilityFactory afDB = new AbilityFactory();
|
AbilityFactory afDB = new AbilityFactory();
|
||||||
subAbAF = (Ability_Sub)afDB.getAbility(sSub, AF.getHostCard());
|
subAbAF = (Ability_Sub)afDB.getAbility(sSub, AF.getHostCard());
|
||||||
hasSubAbAF = true;
|
hasSubAbAF = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
subAbStr = sSub;
|
subAbStr = sSub;
|
||||||
hasSubAbStr = true;
|
hasSubAbStr = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpellAbility getAbility()
|
public SpellAbility getAbility()
|
||||||
{
|
{
|
||||||
@@ -224,6 +224,10 @@ import java.util.Random;
|
|||||||
|
|
||||||
// TODO handle proper calculation of X values based on Cost
|
// TODO handle proper calculation of X values based on Cost
|
||||||
|
|
||||||
|
if(AF.getHostCard().equals("Stuffy Doll")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (AF.isAbility())
|
if (AF.isAbility())
|
||||||
{
|
{
|
||||||
Random r = new Random(); // prevent run-away activations
|
Random r = new Random(); // prevent run-away activations
|
||||||
@@ -320,18 +324,23 @@ import java.util.Random;
|
|||||||
sb.append(name).append(" - ");
|
sb.append(name).append(" - ");
|
||||||
|
|
||||||
sb.append("Deals ").append(dmg).append(" damage to ");
|
sb.append("Deals ").append(dmg).append(" damage to ");
|
||||||
for(int i = 0; i < tgts.size(); i++){
|
if(tgts == null || tgts.size() == 0) {
|
||||||
if (i != 0)
|
sb.append("itself");
|
||||||
sb.append(" ");
|
}
|
||||||
|
else {
|
||||||
|
for(int i = 0; i < tgts.size(); i++){
|
||||||
|
if (i != 0)
|
||||||
|
sb.append(" ");
|
||||||
|
|
||||||
Object o = tgts.get(0);
|
Object o = tgts.get(0);
|
||||||
if (o instanceof Player){
|
if (o instanceof Player){
|
||||||
sb.append(((Player)o).getName());
|
sb.append(((Player)o).getName());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
sb.append(((Card)o).getName());
|
sb.append(((Card)o).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sb.append(". ");
|
sb.append(". ");
|
||||||
|
|
||||||
@@ -375,30 +384,38 @@ import java.util.Random;
|
|||||||
boolean targeted = (AF.getAbTgt() != null) || TgtOpp;
|
boolean targeted = (AF.getAbTgt() != null) || TgtOpp;
|
||||||
|
|
||||||
if (tgts == null || tgts.size() == 0){
|
if (tgts == null || tgts.size() == 0){
|
||||||
System.out.println("No targets?");
|
System.out.println("AF_DealDamage ("+AF.getHostCard()+") - No targets? Ok. Just making sure.");
|
||||||
return;
|
//if no targets, damage goes to self (Card; i.e. Stuffy Doll)
|
||||||
|
Card c = saMe.getSourceCard();
|
||||||
|
if(AllZone.GameAction.isCardInPlay(c)) {
|
||||||
|
if (noPrevention)
|
||||||
|
c.addDamageWithoutPrevention(dmg, AF.getHostCard());
|
||||||
|
else
|
||||||
|
c.addDamage(dmg, AF.getHostCard());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
for(Object o : tgts){
|
||||||
|
if (o instanceof Card){
|
||||||
|
Card c = (Card)o;
|
||||||
|
if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) {
|
||||||
|
if (noPrevention)
|
||||||
|
c.addDamageWithoutPrevention(dmg, AF.getHostCard());
|
||||||
|
else
|
||||||
|
c.addDamage(dmg, AF.getHostCard());
|
||||||
|
}
|
||||||
|
|
||||||
for(Object o : tgts){
|
}
|
||||||
if (o instanceof Card){
|
else if (o instanceof Player){
|
||||||
Card c = (Card)o;
|
Player p = (Player) o;
|
||||||
if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) {
|
if (!targeted || p.canTarget(AF.getHostCard())) {
|
||||||
if (noPrevention)
|
if (noPrevention)
|
||||||
c.addDamageWithoutPrevention(dmg, AF.getHostCard());
|
p.addDamageWithoutPrevention(dmg, AF.getHostCard());
|
||||||
else
|
else
|
||||||
c.addDamage(dmg, AF.getHostCard());
|
p.addDamage(dmg, AF.getHostCard());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (o instanceof Player){
|
|
||||||
Player p = (Player) o;
|
|
||||||
if (!targeted || p.canTarget(AF.getHostCard())) {
|
|
||||||
if (noPrevention)
|
|
||||||
p.addDamageWithoutPrevention(dmg, AF.getHostCard());
|
|
||||||
else
|
|
||||||
p.addDamage(dmg, AF.getHostCard());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSubAbAF) {
|
if (hasSubAbAF) {
|
||||||
|
|||||||
@@ -2851,7 +2851,39 @@ public class Card extends MyObservable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Stuffy Doll - causes ").append(stuffyDamage).append(" damage to ").append(opponent);
|
sb.append(this.getName()+" - Deals ").append(stuffyDamage).append(" damage to ").append(opponent);
|
||||||
|
ability.setStackDescription(sb.toString());
|
||||||
|
|
||||||
|
AllZone.Stack.add(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.getName().equals("Jackal Pup") || this.getName().equals("Shinka Gatekeeper")) {
|
||||||
|
final Player player = this.getController();
|
||||||
|
final int selfDamage = damageToAdd;
|
||||||
|
SpellAbility ability = new Ability(this, "0") {
|
||||||
|
@Override
|
||||||
|
public void resolve() {
|
||||||
|
player.addDamage(selfDamage, Card.this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(this.getName()+" - Deals ").append(selfDamage).append(" damage to ").append(player);
|
||||||
|
ability.setStackDescription(sb.toString());
|
||||||
|
|
||||||
|
AllZone.Stack.add(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.getName().equals("Filthy Cur")) {
|
||||||
|
final Player player = this.getController();
|
||||||
|
final int life = damageToAdd;
|
||||||
|
SpellAbility ability = new Ability(this, "0") {
|
||||||
|
@Override
|
||||||
|
public void resolve() {
|
||||||
|
player.loseLife(life, Card.this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(this.getName()+" - ").append(player).append(" loses ").append(life).append("life");
|
||||||
ability.setStackDescription(sb.toString());
|
ability.setStackDescription(sb.toString());
|
||||||
|
|
||||||
AllZone.Stack.add(ability);
|
AllZone.Stack.add(ability);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
|
|
||||||
public static Card getCard(final Card card, String cardName, Player owner, CardFactory cf) {
|
public static Card getCard(final Card card, String cardName, Player owner, CardFactory cf) {
|
||||||
|
/*
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
if(cardName.equals("Filthy Cur")) {
|
if(cardName.equals("Filthy Cur")) {
|
||||||
final Card newCard = new Card() {
|
final Card newCard = new Card() {
|
||||||
@@ -94,9 +94,10 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
return newCard;
|
return newCard;
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
*/
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Stone Giant")) {
|
if(cardName.equals("Stone Giant")) {
|
||||||
final ArrayList<Card> Tgt = new ArrayList<Card>();
|
final ArrayList<Card> Tgt = new ArrayList<Card>();
|
||||||
|
|
||||||
final Command untilEOT = new Command() {
|
final Command untilEOT = new Command() {
|
||||||
@@ -243,7 +244,7 @@ public class CardFactory_Creatures {
|
|||||||
a1.setBeforePayMana(CardFactoryUtil.input_targetPlayer(a1));
|
a1.setBeforePayMana(CardFactoryUtil.input_targetPlayer(a1));
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
/*
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Shinka Gatekeeper")) {
|
else if(cardName.equals("Shinka Gatekeeper")) {
|
||||||
final Card newCard = new Card() {
|
final Card newCard = new Card() {
|
||||||
@@ -327,7 +328,7 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Stuffy Doll")) {
|
else if(cardName.equals("Stuffy Doll")) {
|
||||||
/*
|
/
|
||||||
final Card newCard = new Card() {
|
final Card newCard = new Card() {
|
||||||
Card c = this;
|
Card c = this;
|
||||||
|
|
||||||
@@ -365,7 +366,7 @@ public class CardFactory_Creatures {
|
|||||||
newCard.setBaseDefense(1);
|
newCard.setBaseDefense(1);
|
||||||
|
|
||||||
newCard.addIntrinsicKeyword("Indestructible");
|
newCard.addIntrinsicKeyword("Indestructible");
|
||||||
*/
|
*
|
||||||
|
|
||||||
Ability_Cost abilCost = new Ability_Cost("T", cardName, true);
|
Ability_Cost abilCost = new Ability_Cost("T", cardName, true);
|
||||||
|
|
||||||
@@ -394,9 +395,9 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
newCard.setSVars(card.getSVars());
|
newCard.setSVars(card.getSVars());
|
||||||
|
|
||||||
return newCard;*/
|
return newCard;*
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
*/
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Serra Avenger")) {
|
else if(cardName.equals("Serra Avenger")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user