MArcomage

Free multiplayer on-line fantasy card game

Please log in

Mojko on 07:18, 12. Aug, 2012
"Replaces your hand with random non-common Dragons with attack<100"

Such effect is not supported. Summoning filter can only select attack cards, but specific attack value can't be extracted.
Fithz Hood on 08:59, 12. Aug, 2012
mmh, and is "total cost<60" possible?
guess no
Mojko on 13:59, 12. Aug, 2012
Cost can be used only by determining type (Bricks only, recruits only...), but not exact amount.
Fithz Hood on 14:17, 12. Aug, 2012
but dark templar uses that kind of parameter
Mojko on 14:48, 12. Aug, 2012
It can be used when discarding cards, but not when summoning.
Fithz Hood on 19:49, 12. Aug, 2012
are you sure? I've created this code:


$tmp = 5 * $this->KeywordCount($mydata->Hand, "Dragon");
$mydata->Bricks+= $tmp; $mydata->Gems+= $tmp; $mydata->Recruits+= $tmp;
$drag = $carddb->GetList(array('keyword'=>"Dragon"));
$dragonarray = $carddb->GetList(array('keyword'=>"Dragon"));
$max=count($dragonarray);
for ($i = 1; $i <= $max; $i++)
{
if ($carddb->GetCard($drag[$i])->GetResources('') > 60)
{
$dragonarray = array_diff($dragonarray, array($drag[$i]->ID));
}
}
$mydata->Hand = $this->DrawHand_list($dragonarray);
$mydata->NewCards = array(1=> 1, 1, 1, 1, 1, 1, 1, 1);
$nextcard = 0;


but it's not working.
it creates an array of dragons then it checks the array with a "for" looking for dragons with cost>60, then it should remove those dragon from the array using the "array_diff" instruction. but I'e tested the card and it gives a hand of dragons with any kind of cost.
what am I doing wrong?
Mojko on 06:24, 13. Aug, 2012
Well, yes it can be done this way. But as I said the card filter does not support exact card cost, so basically you have to filter out all dragons and then remove those with inappropriate cost manually. Like this:



$tmp = 5 * $this->KeywordCount($mydata->Hand, "Dragon");
$mydata->Bricks+= $tmp; $mydata->Gems+= $tmp; $mydata->Recruits+= $tmp;
$all_dragons = $carddb->GetList(array('keyword'=>"Dragon"));
$good_dragons = array();
foreach ($all_dragons as $dragon_id)
{
if ($carddb->GetCard($dragon_id)->GetResources('') <= 60)
{
$good_dragons[] = $dragon_id;
}
}
$mydata->Hand = $this->DrawHand_list($good_dragons);
$mydata->NewCards = array(1=> 1, 1, 1, 1, 1, 1, 1, 1);
$nextcard = 0;


I don't like this approach performance-wise. You need to extract card definition for each dragon separately to determine their total cost. A better approach would be to take all card definitions at once, like this:



$tmp = 5 * $this->KeywordCount($mydata->Hand, "Dragon");
$mydata->Bricks+= $tmp; $mydata->Gems+= $tmp; $mydata->Recruits+= $tmp;
$all_dragons = $carddb->GetList(array('keyword'=>"Dragon"));
$all_dragons = $carddb->GetData($all_dragons);
$good_dragons = array();
foreach ($all_dragons as $card_data)
{
if (($card_data['bricks'] + $card_data['gems'] + $card_data['recruits']) <= 60)
{
$good_dragons[] = $card_data['id'];
}
}
$mydata->Hand = $this->DrawHand_list($good_dragons);
$mydata->NewCards = array(1=> 1, 1, 1, 1, 1, 1, 1, 1);
$nextcard = 0;
Fithz Hood on 13:39, 13. Aug, 2012
I see, nice code.
I don't know how to use this program language (I don't even know its name) I've created my code stealing lines from Dark templar, Angel and Dark legion.
Also my first attemp was to create an empty array and filling it with good dragons, but I really didn't know how.
Thanks for the code, it has some good lines I could steal.
Mojko on 13:45, 13. Aug, 2012
You have a soul of programmer Fithz ;-) The language is called PHP btw :)
Fithz Hood on 14:13, 13. Aug, 2012
I've used your code, it works perfectly
this was a common version setted at <16: http://imageshack.us/photo/my-images/507/dragonage.jpg/
Mojko on 14:22, 13. Aug, 2012
:)