spPumpTgt Revision
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			21 posts
			 • Page 1 of 2 • 1, 2
		
	
spPumpTgt Revision
 by Rob Cashwalker » 28 Jan 2010, 02:00
by Rob Cashwalker » 28 Jan 2010, 02:00 
Updated spPumpTgt to enable new technology for Count$ and Drawback$.
Nothing amazingly new with the syntax:
New Drawback$ method - DamageTgtC/NumDamage
The following cards can be modified in cards.txt (might be a tad out-of date, as the list was compiled before the Draw a card Cantrip conversion was done) (this includes cards which were previously hard-coded without the spPumpTgt in cards.txt, they can be commented):
			Nothing amazingly new with the syntax:
- Code: Select all
- spPumpTgt:p/t{:Drawback$}{:spDescription}{:stDescription}
 spPumpTgt:k{:Drawback$}{:spDescription}{:stDescription}
 spPumpTgt:p/t/k{:Drawback$}{:spDescription}{:stDescription}
New Drawback$ method - DamageTgtC/NumDamage
The following cards can be modified in cards.txt (might be a tad out-of date, as the list was compiled before the Draw a card Cantrip conversion was done) (this includes cards which were previously hard-coded without the spPumpTgt in cards.txt, they can be commented):
- Code: Select all
- Wildsize
 2 G
 Instant
 no text
 spPumpTgt:+2/+2/Trample
 Draw a card.
 Infiltrate
 U
 Instant
 no text
 spPumpTgt:Unblockable:Target creature is unblockable this turn.:Infiltrate - Target creature is unblockable this turn.
 Giant Growth
 G
 Instant
 no text
 spPumpTgt:+3/+3
 Accelerate
 1 R
 Instant
 no text
 spPumpTgt:Haste
 Draw a card.
 Cloak of Feathers
 U
 Sorcery
 no text
 spPumpTgt:Flying
 Draw a card.
 Unnatural Speed
 R
 Instant
 no text
 spPumpTgt:Haste
 Shriek of Dread
 1 B
 Instant
 no text
 spPumpTgt:Fear
 Shadow Rift
 U
 Instant
 no text
 spPumpTgt:Shadow
 Draw a card.
 Leap
 U
 Instant
 no text
 spPumpTgt:Flying
 Draw a card.
 Lace with Moonglove
 2 G
 Instant
 no text
 spPumpTgt:Deathtouch
 Draw a card.
 Jump
 U
 Instant
 no text
 spPumpTgt:Flying
 Double Cleave
 1 RW
 Instant
 no text
 spPumpTgt:Double Strike
 Breach
 2 B
 Instant
 no text
 spPumpTgt:+2/+0/Fear
 Wielding the Green Dragon
 1 G
 Sorcery
 no text
 spPumpTgt:+4/+4
 Screaming Fury
 2 R
 Sorcery
 no text
 spPumpTgt:+5/+0/Haste
 Sangrite Surge
 4 R G
 Sorcery
 no text
 spPumpTgt:+3/+3/Double Strike
 Monstrous Growth
 1 G
 Sorcery
 no text
 spPumpTgt:+4/+4
 Howling Fury
 2 B
 Sorcery
 no text
 spPumpTgt:+4/+0
 Fit of Rage
 1 R
 Sorcery
 no text
 spPumpTgt:+3/+3/First Strike
 Sudden Strength
 3 G
 Instant
 no text
 spPumpTgt:+3/+3
 Draw a card.
 Silk Net
 G
 Instant
 no text
 spPumpTgt:+1/+1/Reach
 Predator's Strike
 1 G
 Instant
 no text
 spPumpTgt:+3/+3/Trample
 Kindled Fury
 R
 Instant
 no text
 spPumpTgt:+1/+0/First Strike
 Fists of the Anvil
 1 R
 Instant
 no text
 spPumpTgt:+4/+0
 Fanatical Fever
 2 G G
 Instant
 no text
 spPumpTgt:+3/+0/Trample
 Colossal Might
 R G
 Instant
 no text
 spPumpTgt:+4/+2/Trample
 Aggressive Urge
 1 G
 Instant
 no text
 spPumpTgt:+1/+1
 Draw a card.
 Angelic Blessing
 2 W
 Sorcery
 no text
 spPumpTgt:+3/+3/Flying
 Riding Red Hare
 2 W
 Sorcery
 no text
 spPumpTgt:+3/+3/Horsemanship
 Slaughter Cry
 2 R
 Instant
 no text
 spPumpTgt:+3/+0/First Strike
 Touch of Invisibility
 3 U
 Sorcery
 no text
 Draw a card.
 spPumpTgt:Unblockable:Target creature is unblockable this turn.:Touch of Invisibility - Target creature is unblockable this turn.
 Trailblazer
 2 G G
 Instant
 no text
 spPumpTgt:Unblockable:Target creature is unblockable this turn.:Trailblazer - Target creature is unblockable this turn.
 Gerrard's Command
 W G
 Instant
 no text
 spPumpTgt:+3/+3:Drawback$UntapTgt:Untap target creature. It gets +3/+3 until end of turn.:Untap target creature. It gets +3/+3 until end of turn.
 Brute Force
 R
 Instant
 no text
 spPumpTgt:+3/+3
 Guided Strike
 1 W
 Instant
 no text
 spPumpTgt:+1/+0/First strike
 Draw a card.
 Might of Oaks
 3 G
 Instant
 no text
 spPumpTgt:+7/+7
 Inspirit
 2 W
 Instant
 no text
 spPumpTgt:+2/+4:Drawback$UntapTgt:Untap target creature. It gets +2/+4 until end of turn.:Insprit - Untap target creature. It gets +2/+4 until end of turn.
- Code: Select all
- Accelerated Mutation
 3 G G
 Instant
 no text
 spPumpTgt:Count$MaxCMCYouCtrl/Count$MaxCMCYouCtrl:Target creature gets +X/+X until end of turn, where X is the highest converted mana cost among permanents you control.:Target creature gets +X/+X until end of turn.
 Burning Cloak
 R
 Sorcery
 no text
 spPumpTgt:+2/+0:Drawback$DamageTgtC/2:Target creature gets +2/+0 until end of turn. Burning Cloak deals 2 damage to that creature.
 Flowstone Strike
 1 R
 Instant
 no text
 spPumpTgt:+1/-1/Haste
 Gaea's Might
 G
 Instant
 no text
 spPumpTgt:Count$Domain/Count$Domain:Domain - Target creature gets +1/+1 until end of turn for each basic land type among lands you control.:Target creature gets +Domain/+Domain until end of turn.
 Ghoul's Feast
 1 B
 Instant
 no text
 spPumpTgt:Count$TypeInYourYard.Creature/+0:Target creature gets +X/+0 until end of turn, where X is the number of creature cards in your graveyard.
 ==
 Hunger of the Nim
 1 B
 Sorcery
 no text
 spPumpTgt:Count$TypeYouCtrl.Artifact/+0:Target creature gets +1/+0 for each artifact you control.:Hunger of the Nim - Target creature gets +X/+0
- Code: Select all
- Inner Calm, Outer Strength
 2 G
 Instant Arcane
 no text
 spPumpTgt:Count$CardsInYourHand/Count$CardsInYourHand:Target creature gets +X/+X until end of turn, where X is the number of cards in your hand.:Inner Calm, Outer Strength - Target creature gets +X/+X
- Code: Select all
- Iron Will
 W
 Instant
 no text
 spPumpTgt:+0/+4
 Cycling:2
 Might of Alara
 G
 Instant
 no text
 spPumpTgt:Count$Domain/Count$Domain:Domain - Target creature gets +1/+1 until end of turn for each basic land type among lands you control.
 Muscle Burst
 1 G
 Instant
 no text
 spPumpTgt:Count$NamedInAllYards.Muscle Burst\Plus.3/Count$NamedInAllYards.Muscle Burst\Plus.3:Target creature gets +X/+X until end of turn, where X is 3 plus the number of cards named Muscle Burst in all graveyards.:Muscle Burst - Target creature gets +X/+X until end of turn.
 Primal Bellow
 G
 Instant
 no text
 spPumpTgt:Count$TypeYouCtrl.Forest/Count$TypeYouCtrl.Forest:Target creature gets +1/+1 until end of turn for each Forest you control:Primal Bellow - Target creature gets +X/+X until end of turn
 Stand Firm
 W
 Instant
 no text
 spPumpTgt:+1/+1:
 Scry 2
 Strength of Cedars
 4 G
 Instant Arcane
 no text
 spPumpTgt:Count$TypeYouCtrl.Land/Count$TypeYouCtrl.Land:Target creature gets +X/+X until end of turn, where X is the number of lands you control.:Strength of Cedars - Target creature gets +X/+X until end of turn.
 Wirewood Pride
 G
 Instant
 no text
 spPumpTgt:Count$TypeOnBattlefield.Elf/Count$TypeOnBattlefield.Elf:Target creature gets +X/+X until end of turn, where X is the number of Elves on the battlefield.:Wirewood Pride - Target creature get +X/+X until end of turn.
- Code: Select all
- // Generic target creature pump
 if (hasKeyword(card, "spPumpTgt") != -1)
 {
 int n = hasKeyword(card, "spPumpTgt");
 
 String parse = card.getKeyword().get(n).toString();
 card.removeIntrinsicKeyword(parse);
 
 String k[] = parse.split(":");
 
 final int NumAttack[] = {-1138};
 final String AttackX[] = {"none"};
 final int NumDefense[] = {-1138};
 final String DefenseX[] = {"none"};
 final String Keyword[] = {"none"};
 
 String ptk[] = k[1].split("/");
 
 if (ptk.length == 1)
 Keyword[0] = ptk[0];
 
 if (ptk.length >= 2)
 {
 if (ptk[0].length() <= 3)
 NumAttack[0] = Integer.parseInt(ptk[0].replace("+", ""));
 else
 if (ptk[0].startsWith("Count$"))
 {
 String kk[] = ptk[0].split("\\$");
 AttackX[0] = kk[1].replace("\\", "/");
 }
 
 if (ptk[1].length() <= 3)
 NumDefense[0] = Integer.parseInt(ptk[1].replace("+", ""));
 else
 if (ptk[1].startsWith("Count$"))
 {
 String kk[] = ptk[1].split("\\$");
 DefenseX[0] = kk[1].replace("\\", "/");
 }
 }
 
 if (ptk.length == 3)
 Keyword[0] = ptk[2];
 
 final String DrawBack[] = {"none"};
 final String spDesc[] = {"none"};
 final String stDesc[] = {"none"};
 //String d = new String("none");
 StringBuilder sb = new StringBuilder();
 
 if ((AttackX[0].equals("none") && !(NumAttack[0] == -1138)) && (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && Keyword[0].equals("none"))
 {
 // pt boost
 sb.append("Target creature gets ");
 
 if (NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
 sb.append("+");
 else if (NumAttack[0] < 0 || (NumAttack[0] == 0 && NumDefense[0] < 0)) // -0/-1
 sb.append("-");
 
 sb.append(Math.abs(NumAttack[0]) + "/");
 
 if (NumDefense[0] > 0 || (NumDefense[0] == 0 && NumAttack[0] > 0)) // +1/+0
 sb.append("+");
 else if (NumDefense[0] < 0 || (NumDefense[0] == 0 && NumAttack[0] < 0)) // -1/-0
 sb.append("-");
 
 sb.append(Math.abs(NumDefense[0]) + " until end of turn.");
 }
 if ((AttackX[0].equals("none") && NumAttack[0] == -1138) && (DefenseX[0].equals("none") && NumDefense[0] == -1138) && !Keyword[0].equals("none"))
 {
 // k boost
 sb.append("Target creature gains " + Keyword[0] + " until end of turn.");
 }
 if ((AttackX[0].equals("none") && !(NumAttack[0] == -1138)) && (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && !Keyword[0].equals("none"))
 {
 // ptk boost
 sb.append("Target creature gets ");
 
 if (NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
 sb.append("+");
 else if (NumAttack[0] < 0 || (NumAttack[0] == 0 && NumDefense[0] < 0)) // -0/-1
 sb.append("-");
 
 sb.append(Math.abs(NumAttack[0]) + "/");
 
 if (NumDefense[0] > 0 || (NumDefense[0] == 0 && NumAttack[0] > 0)) // +1/+0
 sb.append("+");
 else if (NumDefense[0] < 0 || (NumDefense[0] == 0 && NumAttack[0] < 0)) // -1/-0
 sb.append("-");
 
 sb.append(Math.abs(NumDefense[0]));
 
 sb.append(" and gains " + Keyword[0] + " until end of turn.");
 }
 if (k.length > 2)
 {
 if (k[2].contains("Drawback$"))
 {
 String kk[] = k[2].split("\\$");
 DrawBack[0] = kk[1];
 if (k.length > 3)
 spDesc[0] = k[3];
 if (k.length > 4)
 stDesc[0] = k[4];
 }
 else
 {
 if (k.length > 2)
 spDesc[0] = k[2];
 if (k.length > 3)
 stDesc[0] = k[3];
 }
 }
 else
 if (!sb.toString().equals("none"))
 {
 spDesc[0] = sb.toString();
 stDesc[0] = sb.toString();
 }
 SpellAbility spPump = new Spell(card)
 {
 private static final long serialVersionUID = 42244224L;
 
 private int getNumAttack()
 {
 if (NumAttack[0] != -1138)
 return NumAttack[0];
 
 if (! AttackX[0].equals("none"))
 return CardFactoryUtil.xCount(card, AttackX[0]);
 
 return 0;
 }
 private int getNumDefense()
 {
 if (NumDefense[0] != -1138)
 return NumDefense[0];
 
 if (! DefenseX[0].equals("none"))
 return CardFactoryUtil.xCount(card, DefenseX[0]);
 
 return 0;
 }
 public boolean canPlayAI()
 {
 int defense = getNumDefense();
 
 if (AllZone.Phase.getPhase().equals(Constant.Phase.Main2))
 return false;
 
 CardList list = getCreatures();
 if (!list.isEmpty())
 {
 boolean goodt = false;
 Card t = new Card();
 while (goodt == false && !list.isEmpty())
 {
 t = CardFactoryUtil.AI_getBestCreature(list);
 if ((t.getNetDefense() + defense) > 0)
 goodt = true;
 else
 list.remove(t);
 }
 if (goodt == true)
 {
 setTargetCard(t);
 return true;
 }
 }
 
 return false;
 }
 
 CardList getCreatures()
 {
 CardList list = new CardList(AllZone.Computer_Play.getCards());
 list = list.filter(new CardListFilter()
 {
 public boolean addCard(Card c)
 {
 if (c.isCreature())
 {
 if (c.hasSickness() && Keyword[0].equals("Haste"))
 return CardFactoryUtil.canTarget(card, c);
 
 return (CardFactoryUtil.AI_doesCreatureAttack(c)) &&
 (CardFactoryUtil.canTarget(card, c)) &&
 (!Keyword[0].equals("none") && !c.getKeyword().contains(Keyword[0])) &&
 (! (! c.hasSickness()) && Keyword[0].equals("Haste"));
 }
 return false;
 }
 });
 return list;
 }
 
 public void resolve()
 {
 if (AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()))
 {
 final Card[] creature = new Card[1];
 creature[0] = getTargetCard();
 
 final int a = getNumAttack();
 final int d = getNumDefense();
 
 final Command untilEOT = new Command()
 {
 private static final long serialVersionUID = -42244224L;
 
 public void execute()
 {
 if (AllZone.GameAction.isCardInPlay(creature[0]))
 {
 creature[0].addTempAttackBoost(-1 * a);
 creature[0].addTempDefenseBoost(-1 * d);
 
 if (!Keyword[0].equals("none"))
 creature[0].removeExtrinsicKeyword(Keyword[0]);
 }
 }
 };
 
 creature[0].addTempAttackBoost(a);
 creature[0].addTempDefenseBoost(d);
 if (! Keyword[0].equals("none"))
 creature[0].addExtrinsicKeyword(Keyword[0]);
 
 AllZone.EndOfTurn.addUntil(untilEOT);
 
 if (! DrawBack[0].equals("none"))
 CardFactoryUtil.doDrawBack(DrawBack[0], 0, card.getController(), AllZone.GameAction.getOpponent(card.getController()), creature[0].getController(), card, creature[0]);
 }
 }//resolve
 };//SpellAbility
 
 spPump.setBeforePayMana(CardFactoryUtil.input_targetCreature(spPump));
 spPump.setDescription(spDesc[0]);
 spPump.setStackDescription(stDesc[0]);
 
 card.clearSpellAbility();
 card.addSpellAbility(spPump);
 }
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spPumpTgt Revision
 by zerker2000 » 28 Jan 2010, 04:39
by zerker2000 » 28 Jan 2010, 04:39 
Small request: would it be possible to use X where specified(including in damgTgt), e.g.
			- Code: Select all
- Accelerated Mutation
 3 G G
 Instant
 no text
 spPumpTgt:+X/+X
 X:Count$MaxCMCYouCtrl:"the highest converted mana cost among permanents you control."
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
		Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: spPumpTgt Revision
 by Rob Cashwalker » 28 Jan 2010, 12:54
by Rob Cashwalker » 28 Jan 2010, 12:54 
You've lost me. What exactly are you trying to achieve that's different from how it currently works?
			The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spPumpTgt Revision
 by zerker2000 » 29 Jan 2010, 02:32
by zerker2000 » 29 Jan 2010, 02:32 
Splitting "+x/+x" from "x is", and reusing "x is" for "damg x", "draw x","x/x+1" etc.. And possibly adding a "for x"/"for $Math" while you're at it  .
.
			 .
.O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
		Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: spPumpTgt Revision
 by Rob Cashwalker » 29 Jan 2010, 03:22
by Rob Cashwalker » 29 Jan 2010, 03:22 
That's exactly what it does.
All the keywords I've revised support this syntax for counting X:
spPumpTgt:Count${SomeCriteria}/Count${SomeCriteria}
spDraw:Count${SomeCriteria}
spDamageTgt:Count${SomeCriteria}
There's a method in CardFactoryUtil called xCount(). It handles the actual counting process (plus math) and returns the result.
When the Ability.resolve method fires, it counts X, and also passes it to the Drawback handler. The Drawback$ parameter usually includes a numeric element, though it may also be "X", which means take the calculated value for X from the passed parameter (passed to CardFactoryUtil.doDrawback()).
			All the keywords I've revised support this syntax for counting X:
spPumpTgt:Count${SomeCriteria}/Count${SomeCriteria}
spDraw:Count${SomeCriteria}
spDamageTgt:Count${SomeCriteria}
There's a method in CardFactoryUtil called xCount(). It handles the actual counting process (plus math) and returns the result.
When the Ability.resolve method fires, it counts X, and also passes it to the Drawback handler. The Drawback$ parameter usually includes a numeric element, though it may also be "X", which means take the calculated value for X from the passed parameter (passed to CardFactoryUtil.doDrawback()).
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
- 
				 
 DennisBergkamp
- AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: spPumpTgt Revision
 by zerker2000 » 29 Jan 2010, 07:42
by zerker2000 » 29 Jan 2010, 07:42 
I understand.
However, I meant adding X:$Math as a separate keyword, splitting in cards.txt rather than the keyword parser.
			However, I meant adding X:$Math as a separate keyword, splitting in cards.txt rather than the keyword parser.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
		Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: spPumpTgt Revision
 by Rob Cashwalker » 29 Jan 2010, 16:29
by Rob Cashwalker » 29 Jan 2010, 16:29 
Wouldn't help much, the keyword handler code would still need to know if it was dealing with +X/+X or +3/+3.
Take Aspect of Wolf for another example of why it doesn't work.
Aspect of Wolf 1G
Enchantment - Aura
Enchant creature
Enchanted creature gets +X/+Y, where X is half the number of Forests you control, rounded down, and Y is half the number of Forests you control, rounded up.
If and when I get to using keywords on enchantments, it would use syntax like this:
enPump:Count$TypeYouCtrl.Forest\HalfDown/Count$TypeYouCtrl.Forest\HalfUp
			Take Aspect of Wolf for another example of why it doesn't work.
Aspect of Wolf 1G
Enchantment - Aura
Enchant creature
Enchanted creature gets +X/+Y, where X is half the number of Forests you control, rounded down, and Y is half the number of Forests you control, rounded up.
If and when I get to using keywords on enchantments, it would use syntax like this:
enPump:Count$TypeYouCtrl.Forest\HalfDown/Count$TypeYouCtrl.Forest\HalfUp
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spPumpTgt Revision
 by zerker2000 » 29 Jan 2010, 19:43
by zerker2000 » 29 Jan 2010, 19:43 
I am pretty sure "if(Char.isDidgit(str.charAt(0))" would
An work nicely.
Using my concept:
			An work nicely.
Using my concept:
- Code: Select all
- Aspect of Wolf 1G
 Enchantment - Aura
 Enchant creature
 no text
 enPump:+X/+Y
 X:Count$TypeYouCtrl.Forest\HalfDown
 Y:Count$TypeYouCtrl.Forest\HalfUp
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
		Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: spPumpTgt Revision
 by DennisBergkamp » 29 Jan 2010, 20:09
by DennisBergkamp » 29 Jan 2010, 20:09 
Yeah they should be able to, as you said, Equipment and Auras are both pretty much identically coded.
			
		- 
				 
 DennisBergkamp
- AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: spPumpTgt Revision
 by Rob Cashwalker » 30 Jan 2010, 00:34
by Rob Cashwalker » 30 Jan 2010, 00:34 
OK Zerker, I see where you're going. I'm trying to figure out if it is going to make things more difficult to manage. The only thing I can think of, is that since these need to be parsed separately, before parsing the keyword itself, at the beginning of the getCard2 method in CardFactory.
The card object will need two string properties (with get/set) XString, and YString.
In the long run, are we gaining any other benefit, or is it just that it's easier to read? There are a number of changes necessary in order to do it.
			The card object will need two string properties (with get/set) XString, and YString.
In the long run, are we gaining any other benefit, or is it just that it's easier to read? There are a number of changes necessary in order to do it.
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spPumpTgt Revision
 by Rob Cashwalker » 30 Jan 2010, 01:15
by Rob Cashwalker » 30 Jan 2010, 01:15 
I'm thinking about something radical here, and I want to know if I added this code to Card.java, would it do what I think it would?
SVar:X:Count$TypeYouCtrl.Forest\HalfDown
SVar:Y:Count$TypeYouCtrl.Forest\HalfUp
And by extension of the concept:
SVar:DB:Drawback$DamageYou/1
SVar:Tgt:Target$NonBlack+NonArtifact+Creature
SVar:spDesc:Target creature gets +X/+Y until end of turn, where X is equal to the number of Forests you control and Y is equal to the number of Forests you control.
			- Code: Select all
- private Hashtable<String,String> SVars = new Hashtable<String,String>();
 public String getSVar(String Var)
 {
 if (SVars.contains(Var))
 return SVars.get(Var);
 else
 return new String("");
 }
 public void SetSVar(String Var, String str)
 {
 if (SVars.contains(Var))
 SVars.remove(Var);
 
 SVars.put(Var, str);
 }
- Code: Select all
- n = hasKeyword("SVar");
 if (n != -1)
 {
 String k = card.getKeyword(n);
 Card.removeKeyword(n);
 String kk[] = k.split(":);
 String v = kk[1];
 Card.setSVar(v, kk[2]);
 }
SVar:X:Count$TypeYouCtrl.Forest\HalfDown
SVar:Y:Count$TypeYouCtrl.Forest\HalfUp
And by extension of the concept:
SVar:DB:Drawback$DamageYou/1
SVar:Tgt:Target$NonBlack+NonArtifact+Creature
SVar:spDesc:Target creature gets +X/+Y until end of turn, where X is equal to the number of Forests you control and Y is equal to the number of Forests you control.
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spPumpTgt Revision
 by zerker2000 » 30 Jan 2010, 02:36
by zerker2000 » 30 Jan 2010, 02:36 
It should...at the rate this is going, cards.txt will look like that syntax I tried to implement in "Cleaning CardFactory":). I'm wondering if kicker / additional costs could be made the same way.
			O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
		Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: spPumpTgt Revision
 by Rob Cashwalker » 30 Jan 2010, 02:56
by Rob Cashwalker » 30 Jan 2010, 02:56 
Well, then congratulate me for finally understanding how to make use of a HashMap....
There have to be a number of practical uses for these string variables. But making use of them for something like Kicker is still going to take some serious work to implement. (gotta admit I've got some wheels turning)
			There have to be a number of practical uses for these string variables. But making use of them for something like Kicker is still going to take some serious work to implement. (gotta admit I've got some wheels turning)
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spPumpTgt Revision
 by Rob Cashwalker » 30 Jan 2010, 04:03
by Rob Cashwalker » 30 Jan 2010, 04:03 
Now, the next point I need to ask, is that if I go ahead and make these changes, does Chris feel up to updating all the existing cards where Count$ and Drawback$ are used?
			The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
			21 posts
			 • Page 1 of 2 • 1, 2
		
	
Who is online
Users browsing this forum: Timothysow and 19 guests
 
 