tag:blogger.com,1999:blog-889604442512373664.post1609039034040510974..comments2023-10-31T08:28:52.391-07:00Comments on Computer Programming and Magic: The Gathering: Shock and Royal Assassin – Part 1Forgehttp://www.blogger.com/profile/15838286606081721333noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-889604442512373664.post-16159532590953989452009-12-03T10:12:37.680-08:002009-12-03T10:12:37.680-08:00Forge does intertwine AI code and card code.
Tap ...Forge does intertwine AI code and card code.<br /><br />Tap abilities are "hacked" and aren't handled very well. They work according to the rules but the code is ugly and could be refined (as well as the rules logic in general).Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-51709406429675293972009-11-30T22:34:41.795-08:002009-11-30T22:34:41.795-08:00take into account, it's not a blame, just sugg...take into account, it's not a blame, just suggestion ;)<br /><br />previously I proposed you to use target legality check on resolve, but then realized (thanks to Rob and DennisBergkamp) that it's much harder to you as you need always to keep in mind the AI hard coded in every card<br /><br />p.s. please check ccgh, I've sent you PM therenantuko84https://www.blogger.com/profile/15891352523600843744noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-18419843486182217282009-11-30T22:25:23.878-08:002009-11-30T22:25:23.878-08:00wagic code is elegant, but it uses another approac...wagic code is elegant, but it uses another approach for AI that's why it is hard to compare<br /><br />and about your code: I can suggest to create generic method or factory for such input, smth like<br />Input target = TargetInputFactory.getInput("Select <br />target tapped creature to destroy", new CardListFilter() { public boolean addCard(Card c) {<br /> return c.isCreature() && c.isTapped() }});<br />as I can see it contains very common code that can be reused for great amount of cards.<br />e.g. Doom Blade will have:<br />Input target = TargetInputFactory.getInput("Select <br />target nonblack creature to destroy", new CardListFilter() { public boolean addCard(Card c) {<br /> return c.isCreature() && !c.getColor().contains(Constant.Color.Black) }});<br /><br />and one more: why do you tap Assasin in Input (class that is for targeting only)? Royal has Ability_Tap, shouldn't it be tapped somewhere inside engine as a cost?nantuko84https://www.blogger.com/profile/15891352523600843744noreply@blogger.com