MArcomage

Free multiplayer on-line fantasy card game

Please log in

NG_Beholder on 21:51, 7. Dec, 2012
This keyword does not remove resources properly.
http://arcomage.net/?location=Replays_details&CurrentReplay=284817&PlayerView=1&Turn=19
I guess in this replay Charge keyword broke 1 more gem than opponent had.

[moderator DPsycho: created clickable link]
Coolis on 01:39, 8. Dec, 2012
It should be fixed imo. Creates confusion and too much randomness.
Mojko on 07:20, 8. Dec, 2012
As far as I can see opponent had 14 gems and 0 gems after, while displaying that 14 gems were removed. Can you please elaborate?
NG_Beholder on 07:34, 8. Dec, 2012
Imperial army has Charge(45), but opponent lost 18B + 14G + 12R - 44 resources. Gems is the only resource that was lowered to 0, so I guess that Charge removed 15 gems despite opponent had only 14.
Mojko on 08:50, 8. Dec, 2012
The resource reduction doesn't take into consideration if opponent has some resources left or not. When executed, his gems where actually set to -1, but the game limit will cap it to 0.
Noak on 12:02, 8. Dec, 2012
why not just change it so it always removes the highest resource? it could even be done in a way so if it ties it always takes brick>gem>recruit (or whatever order you want those to be in), then you can know beforehand what the outcome of your play will be, personally i think we should shy from to much randomness in cards.

edit: by this i mean that if you have say 12/10/16 and a are hit by a charge(8) you will end up with 10/10/10
dimitris on 14:41, 8. Dec, 2012
Looking at the Charge code, I believe that it does not reduce the $total variable on each step, and also it checks the wrong variables for bricks, gems and recruits number ($bricks, $gems, $recruits instead oh $hisdata->Bricks etc.). So, this could lead to negative values, meaning some resource gets reduced more than it can be reduced and the other two resources are ignored.

Here's a snippet of the original code:



if ($total > 0)
for ($i = 1; $i <= $charge_damage; $i++)
{
$tmp = mt_rand(1,$total);
if ($tmp <= $bricks) $hisdata->Bricks--;
elseif ($tmp <= ($bricks + $gems)) $hisdata->Gems--;
elseif ($tmp <= ($bricks + $gems + $recruits)) $hisdata->Recruits--;
}


I think changing to something like this will fix the problem:



for ($i = 1; $i <= $charge_damage; $i++)
{
$b = $hisdata->Bricks;
$g = $hisdata->Gems;
$r = $hisdata->Recruits;
$total = $b + $g + $r;
$tmp = mt_rand(1, $total);
if ($tmp <= $b && $b > 0) $hisdata->Bricks--;
elseif ($tmp <= ($b + $g) && $g > 0) $hisdata->Gems--;
elseif ($tmp <= ($b + $g + $r) && $r > 0) $hisdata->Recruits--;
}
Mojko on 15:28, 8. Dec, 2012
I'll look into it ;-) Thx for suggestions.