New keyword: stPump
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			42 posts
			 • Page 3 of 3 • 1, 2, 3
		
	
Re: New keyword: stPumpAll
 by Rob Cashwalker » 21 Sep 2010, 20:12
by Rob Cashwalker » 21 Sep 2010, 20:12 
Not really... but I do know where my towel is.   
 
			 
 
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: New keyword: stPumpAll
 by Sloth » 21 Sep 2010, 20:36
by Sloth » 21 Sep 2010, 20:36 
You were right, replaceAll doesn't like "+". Even when I use "[\\.\\+]YouCtrl" it works for ".YouCtrl" but not for "+YouCtrl". I am at a loss here.
Maybe we should just stick to "Creature.Blue.YouCtrl".
			
		Maybe we should just stick to "Creature.Blue.YouCtrl".
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: stPumpAll
 by Rob Cashwalker » 21 Sep 2010, 20:41
by Rob Cashwalker » 21 Sep 2010, 20:41 
Try "[\\\\.\\\\+]YouCtrl"
Actually, if I'm reading the doc right, ".YouCtrl" should cover any instance of "{AnyCharacter}YouCtrl"
			Actually, if I'm reading the doc right, ".YouCtrl" should cover any instance of "{AnyCharacter}YouCtrl"
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: New keyword: stPumpAll
 by Sloth » 21 Sep 2010, 20:53
by Sloth » 21 Sep 2010, 20:53 
No success with either option. I will call it a day. Maybe an idea will strike me tomorrow.Rob Cashwalker wrote:Try "[\\\\.\\\\+]YouCtrl"
Actually, if I'm reading the doc right, ".YouCtrl" should cover any instance of "{AnyCharacter}YouCtrl"
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: stPumpAll
 by Sloth » 22 Sep 2010, 12:37
by Sloth » 22 Sep 2010, 12:37 
EDIT: This does not work
This works:
			
				This works:
- Code: Select all
- public boolean isValidCard(String Restrictions[], String Controller) {
 for (int i=0; i<Restrictions.length; i++)
 {
 if (Restrictions[i].contains("YouCtrl"))
 {
 if (!getController().equals(Controller))
 return false;
 Restrictions[i].replaceAll(".YouCtrl", "");
 Restrictions[i].replaceAll("YouCtrl", "");
 }
 else if (Restrictions[i].contains("YouDontCtrl"))
 {
 if (getController().equals(Controller))
 return false;
 Restrictions[i].replaceAll(".YouDontCtrl", "");
 Restrictions[i].replaceAll("YouDontCtrl", "");
 }
 }
 return isValidCard(Restrictions);
 }
Last edited by Sloth on 22 Sep 2010, 15:12, edited 1 time in total.
					
				
			
		- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: stPumpAll
 by Rob Cashwalker » 22 Sep 2010, 13:56
by Rob Cashwalker » 22 Sep 2010, 13:56 
This works just fine for me:
			- Code: Select all
- String tmp = "Creature.YouCtrl Creature.Blue+YouCtrl";
 ErrorViewer.showError(tmp.replaceAll(".YouCtrl", "MATCH"));
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: New keyword: stPumpAll
 by Sloth » 22 Sep 2010, 15:13
by Sloth » 22 Sep 2010, 15:13 
OK, the problem lies somewhere else. I just found out that Creature.Blue+nonArtifact also doesn't work for some reason. There must be some other part that does not like the "+". I'm gonna search for it.
EDIT: Creature.Blue+nonArtifact does work. I must have made atesting mistake.
			
		EDIT: Creature.Blue+nonArtifact does work. I must have made atesting mistake.
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: stPumpAll
 by Sloth » 23 Sep 2010, 15:25
by Sloth » 23 Sep 2010, 15:25 
I finally found a way to make it work. I used split instead of replaceAll to get rid of "+YouCtrl":
EDIT: Actually this caused .YouDontCtrl to malfunction
			
		- Code: Select all
- public boolean isValidCard(String Restrictions[], String Controller) {
 for (int i=0; i<Restrictions.length; i++)
 {
 if (Restrictions[i].contains("YouCtrl"))
 {
 if (!getController().equals(Controller))
 return false;
 Restrictions[i] = Restrictions[i].split("\\+YouCtrl")[0];
 Restrictions[i].replaceAll(".YouCtrl", "");
 }
 else if (Restrictions[i].contains("YouDontCtrl"))
 {
 if (getController().equals(Controller))
 return false;
 Restrictions[i] = Restrictions[i].split("\\+YouDontCtrl")[0];
 Restrictions[i].replaceAll(".YouDontCtrl", "");
 }
 }
 return isValidCard(Restrictions);
 }
EDIT: Actually this caused .YouDontCtrl to malfunction

- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: stPump
 by silly freak » 23 Sep 2010, 20:39
by silly freak » 23 Sep 2010, 20:39 
damn, now I'm seeing it too! strings are immutable  that's why yourdoesn't work for ".YouControl"
 that's why yourdoesn't work for ".YouControl"

			 that's why yourdoesn't work for ".YouControl"
 that's why yourdoesn't work for ".YouControl"- Code: Select all
- Restrictions[i] = Restrictions[i].replaceAll("[+\\.]YouCtrl", "");

___
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
		where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
- silly freak
- DEVELOPER
- Posts: 598
- Joined: 26 Mar 2009, 07:18
- Location: Vienna, Austria
- Has thanked: 93 times
- Been thanked: 25 times
Re: New keyword: stPump
 by Rob Cashwalker » 23 Sep 2010, 21:31
by Rob Cashwalker » 23 Sep 2010, 21:31 
DOH... that's what I get for typing code in a forum text box off my head. 
			
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: New keyword: stPump
 by Sloth » 24 Sep 2010, 07:04
by Sloth » 24 Sep 2010, 07:04 
I also figured it out this morning, but thanks for the help silly freak. And Rob was right ".YouCtrl" catches both.
By the way: I added Metalcraft as a condition today. I guess Scars is going to be an easy set.
I still have to change the syntax of the boni to P/T/ keyword & keyword & ...
EDIT: ^ Done! ^
			
		By the way: I added Metalcraft as a condition today. I guess Scars is going to be an easy set.
I still have to change the syntax of the boni to P/T/ keyword & keyword & ...
EDIT: ^ Done! ^
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: stPump
 by Sloth » 24 Sep 2010, 11:58
by Sloth » 24 Sep 2010, 11:58 
I also added Enchanted as <Range> to stPump, because there are some auras that have additional effects when Threshold or Hellbent is reached. Those Auras don't need any special AI.
Examples:
			
		Examples:
- Code: Select all
- Name:Kamahl's Desire
 ManaCost:1 R
 Types:Enchantment Aura
 Text:Enchanted creature has first strike.
 K:Enchant creature
 K:enPump:First Strike
 K:stPumpEnchanted:Creature:3/0:Threshold:Threshold - Enchanted creature gets +3/+0 as long as seven or more cards are in your graveyard.
- Code: Select all
- Name:Taste for Mayhem
 ManaCost:R
 Types:Enchantment Aura
 Text:Enchanted creature gets +2/+0.
 K:Enchant creature
 K:enPump:+2/+0
 K:stPumpEnchanted:Creature:2/0:Hellbent:Hellbent - Enchanted creature gets an additional +2/+0 as long as you have no cards in hand.
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
			42 posts
			 • Page 3 of 3 • 1, 2, 3
		
	
Who is online
Users browsing this forum: No registered users and 26 guests
