Soulshift
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
5 posts
• Page 1 of 1
Soulshift
by Chris H. » 11 Dec 2010, 18:36
Someone reported that the cards with Soulshift no longer state that they have Soulshift in the card detail panel. I added the following code to Card.keywordsToText() right below Sloth's recent addition to remove "Curse" from auras:
and Soulshift still does not appear. There is a short section of code in CardFactory that removes the intrinsicKeyword Soulshift. It then adds a DestroyCommand which is found in CardFactoryUtil.
The DestroyCommand creates an ability and the ability includes a setDescription() and a setStackDescription() statement. In a test game a creature with Soulshift was sacrificed and the Soulshift command was executed correctly. The setStackDescription() text appeared on the stack. But no setDescription() text was seen.
I had fun looking at the code and trying to figure this out but I am stuck. I added the missing Soulshift text to the text line for the 18 card txt files that have this ability. It is something of a cop out.
- Code: Select all
else if (keyword.get(i).startsWith("Soulshift")) {
String k = keyword.get(i);
sbLong.append(k).append("\r\n");
}
and Soulshift still does not appear. There is a short section of code in CardFactory that removes the intrinsicKeyword Soulshift. It then adds a DestroyCommand which is found in CardFactoryUtil.
The DestroyCommand creates an ability and the ability includes a setDescription() and a setStackDescription() statement. In a test game a creature with Soulshift was sacrificed and the Soulshift command was executed correctly. The setStackDescription() text appeared on the stack. But no setDescription() text was seen.
I had fun looking at the code and trying to figure this out but I am stuck. I added the missing Soulshift text to the text line for the 18 card txt files that have this ability. It is something of a cop out.
-

Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Soulshift
by friarsol » 11 Dec 2010, 18:51
My code (as usual after a release) is a mess right now. Try this:
In CardFactory after hasKeyword function add this function:
In CardFactory after hasKeyword function add this function:
- Code: Select all
final static int hasKeyword(Card c, String k, int startPos) {
ArrayList<String> a = c.getKeyword();
for(int i = startPos; i < a.size(); i++)
if(a.get(i).toString().startsWith(k)) return i;
return -1;
}
- Code: Select all
while(hasKeyword(card, "Soulshift") != -1) {
- Code: Select all
int shiftPos = hasKeyword(card, "Soulshift");
while(shiftPos != -1) {
int n = shiftPos;
String parse = card.getKeyword().get(n).toString();
String k[] = parse.split(":");
final String manacost = k[1];
card.addDestroyCommand(CardFactoryUtil.ability_Soulshift(card, manacost));
shiftPos = hasKeyword(card, "Soulshift", n+1);
}//Soulshift
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Soulshift
by Chris H. » 11 Dec 2010, 22:48
Thank you Sol.
I just found a few spare moments and tried your suggestion. It works. I will merge this and a few improvements here and there. Another bug bites the dust.

I just found a few spare moments and tried your suggestion. It works. I will merge this and a few improvements here and there. Another bug bites the dust.
-

Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Soulshift
by Chris H. » 12 Dec 2010, 02:32
`Chris H. wrote:I just found a few spare moments and tried your suggestion. It works. I will merge this and a few improvements here and there. Another bug bites the dust.
OK, I merged the bug fix, reverted the Soulshift cards and improved the readability of a few of the keywords that are listed in the card detail panel as part of Card.keywordsToText().
Overall, things are working correctly. I discovered that we appear to no longer have the madness keyword appearing in the card detail panel but I think I know how to fix this issue.
-

Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Soulshift
by Chris H. » 12 Dec 2010, 02:50
`Chris H. wrote:I discovered that we appear to no longer have the madness keyword appearing in the card detail panel but I think I know how to fix this issue.
Yep, I mis-typed the madness keyword into the filter.
-

Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests