CommandArgs and ability.setChooseTargetAI
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
CommandArgs and ability.setChooseTargetAI
by slapshot5 » 25 Oct 2010, 00:44
Hello,
I'm debugging Hedron Crab. After the conversion of Player to a class, it has exposed a NullPointerException. When the Landfall ability of Hedron Crab is resolved for the AI, you get the Exception. When it is resolved when under Human control, everything works fine.
The problem code is at the end of GameActionUtil.landfall_Hedron_Crab():
but, if I change it to this:
Does anyone know this code well enough to dig in?
-slapshot5
I'm debugging Hedron Crab. After the conversion of Player to a class, it has exposed a NullPointerException. When the Landfall ability of Hedron Crab is resolved for the AI, you get the Exception. When it is resolved when under Human control, everything works fine.
The problem code is at the end of GameActionUtil.landfall_Hedron_Crab():
- Code: Select all
else if(c.getController().equals(AllZone.ComputerPlayer)) {
System.out.print("Setting target player: ");
ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
System.out.println("getTargetPlayer(): "+ability.getTargetPlayer());
//AllZone.Stack.add(ability);
}
but, if I change it to this:
- Code: Select all
else if(c.getController().equals(AllZone.ComputerPlayer)) {
System.out.print("Setting target player: ");
ability.setTargetPlayer(AllZone.HumanPlayer);
System.out.println("getTargetPlayer(): "+ability.getTargetPlayer());
AllZone.Stack.add(ability);
}
Does anyone know this code well enough to dig in?
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: CommandArgs and ability.setChooseTargetAI
by Chris H. » 01 Nov 2010, 14:56
Hmmm, I came across similar issues when attempting to fix Brain Freeze. I fixed Brain Freeze by adding the following to the SpellAbility:
and this is basically what you did for the Hedron Crab.
The old syle of card code would have the AI picking the target inside of the SpellAbility and the Human would usually have an input outside of the SpellAbility.
I am starting to realize that the setChooseTargetAI() is meant to allow the AI to set the tartget outside of the SpellAbility.
So, do we just go back to the old style since it still works or does someone feel competent enough to step in and get this working again?
- Code: Select all
@Override
public void chooseTargetAI() {
setTargetPlayer(AllZone.HumanPlayer);
}//chooseTargetAI()
and this is basically what you did for the Hedron Crab.
The old syle of card code would have the AI picking the target inside of the SpellAbility and the Human would usually have an input outside of the SpellAbility.
I am starting to realize that the setChooseTargetAI() is meant to allow the AI to set the tartget outside of the SpellAbility.
So, do we just go back to the old style since it still works or does someone feel competent enough to step in and get this working again?
-
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: CommandArgs and ability.setChooseTargetAI
by mtgrares » 01 Nov 2010, 19:11
Yeah, sorry for the lack of documentation.I am starting to realize that the setChooseTargetAI() is meant to allow the AI to set the target outside of the SpellAbility.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 50 guests