Masticore
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Masticore
by silly freak » 17 Feb 2010, 16:37
this is not more than some debugging output, it should be okay. i can't tell you why exactly it happened if the files are there though...
these libs are available at code.google.com/p/google-collections/
these libs are available at code.google.com/p/google-collections/
___
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: Masticore
by Chris H. » 17 Feb 2010, 17:28
`zen wrote:How do I get these libs?
import com.google.common.base.Function;
import com.google.common.collect.ComputationException;
import com.google.common.collect.MapMaker;
they're coming up as unresolved
There should be a "google-collect-1.0.jar" file in the /res/lib/ folder. You may need to go back to the build path command and make sure that you include the google-collect-1.0.jar file.
-
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: Masticore
by DennisBergkamp » 17 Feb 2010, 17:28
The google collections library should be included already though (in res/lib, or in the source rar I included I put it in /lib).
Just be sure to add it to your build path.
It seems you're very close to getting this thing working Zen
EDIT: seems like Chris just posted a few seconds before I did...
Just be sure to add it to your build path.
It seems you're very close to getting this thing working Zen
EDIT: seems like Chris just posted a few seconds before I did...
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by neil828 » 19 Feb 2010, 02:57
Masticore Dosent say that you dic at random you choose
- neil828
- Posts: 1
- Joined: 19 Feb 2010, 02:39
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by zen » 19 Feb 2010, 19:31
Hi all,
finally got to start programming cards after wasting infinite time on installation and setup issues. Much thanks to Dennis, sillyfreak, and Chris for their help.
so how bout that masticore...
cards.txt is pretty strait forward thanks to the implementation of the card interpreter the team has build, with regeneration, and creature_a to creature_b direct damage built in.
Masticore
4
Artifact Creature
Choose and discard a card during your upkeep, or sacrifice Masticore.
4/4
RegenerateMe:2
abDamageTgtC2:1
so the upkeep code is a little tricky, and needs one last hack i'd say before it works properly.
GameActionUtil.java
finally got to start programming cards after wasting infinite time on installation and setup issues. Much thanks to Dennis, sillyfreak, and Chris for their help.
so how bout that masticore...
cards.txt is pretty strait forward thanks to the implementation of the card interpreter the team has build, with regeneration, and creature_a to creature_b direct damage built in.
Masticore
4
Artifact Creature
Choose and discard a card during your upkeep, or sacrifice Masticore.
4/4
RegenerateMe:2
abDamageTgtC2:1
so the upkeep code is a little tricky, and needs one last hack i'd say before it works properly.
GameActionUtil.java
- Code: Select all
private static void upkeep_Masticore()
{
final String player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);
CardList list = new CardList(playZone.getCards());
list = list.getName("Masticore");
Ability ability;
for (int i = 0; i < list.size(); i++)
{
final Card m = list.get(0);
ability = new Ability(list.get(i), "0")
{
public void resolve()
{ !!!need hack here!!!
AllZone.GameAction.discard(getTargetCard());
}
};// Ability
Input runtime = new Input()
{
private static final long serialVersionUID = -4302110760957471033L;
public void showMessage()
{
stopSetNext(CardFactoryUtil.input_discard());
}
};
ability.setStackDescription(player + "discards a card");
AllZone.Stack.add(ability);
}// for
}//upkeep_Masticore
- zen
- Posts: 27
- Joined: 13 Feb 2010, 19:21
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by DennisBergkamp » 19 Feb 2010, 20:27
I got it working through this piece of code (mostly copied and pasted from Drekavac).
- Code: Select all
private static void upkeep_Masticore()
{
final String player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);
CardList list = new CardList(playZone.getCards());
list = list.getName("Masticore");
Ability ability;
for (int i = 0; i < list.size(); i++)
{
final Card crd = list.get(i);
final Input discard = new Input()
{
private static final long serialVersionUID = 2252076866782738069L;
public void showMessage()
{
AllZone.Display.showMessage(crd + " - Discard a card from your hand");
ButtonUtil.enableOnlyCancel();
}
public void selectCard(Card c, PlayerZone zone)
{
if(zone.is(Constant.Zone.Hand))
{
AllZone.GameAction.discard(c);
stop();
}
}
public void selectButtonCancel()
{
AllZone.GameAction.sacrifice(crd);
stop();
}
};//Input
ability = new Ability(crd, "0")
{
public void resolve()
{
if(crd.getController().equals(Constant.Player.Human))
{
if(AllZone.Human_Hand.getCards().length == 0)
AllZone.GameAction.sacrifice(crd);
else
AllZone.InputControl.setInput(discard);
}
else //comp
{
CardList list = new CardList(AllZone.Computer_Hand.getCards());
if (list.size() != 0)
AllZone.GameAction.discard(list.get(0));
else
AllZone.GameAction.sacrifice(crd);
}//else
}//resolve()
};//Ability
ability.setStackDescription(crd + " - sacrifice Masticore unless you discard a card.");
AllZone.Stack.add(ability);
}// for
}//upkeep_Masticore
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by zen » 20 Feb 2010, 13:01
Thanks for the masticore Dennis.
I learned a lot about message boxes and input from this.
I learned a lot about message boxes and input from this.
- zen
- Posts: 27
- Joined: 13 Feb 2010, 19:21
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by DennisBergkamp » 20 Feb 2010, 19:17
No probs! It was mostly Zerker's code though, he coded Drekavac
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by Rob Cashwalker » 21 Feb 2010, 04:42
It was a fairly ambitious first attempt though.
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: Masticore
by zerker2000 » 21 Feb 2010, 07:28
I don't think I originally coded it; I do remember fixing its inputting while working on some part of comesIntoPlay handling(Drekvac used to force you to discard, and then suicide if the card was a creature).
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: Masticore
by mtgrares » 23 Feb 2010, 20:23
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
56 posts
• Page 4 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 91 guests