Main      Site Guide    
Message Forum
Re: Monster Arena: who goes first?
Posted By: Gil, on host 76.89.243.93
Date: Monday, May 12, 2008, at 23:46:55
In Reply To: Re: Monster Arena: who goes first? posted by Sam on Monday, May 12, 2008, at 13:38:47:

> > While we're talking about game mechanics though, there's something I've been wondering about: in the rules of battle, there's a chart that for d that maps out attack/defense ratios between 0.5 and 2.0. There's a definite pattern for those chart numbers, and it says when d is outside that range, a proportional value is done, but it doesn't seem to follow the same pattern. In the first round of the prelims, I had Gilgamesh with 15 Attack vs. Ballclod's 7 Defense, I would've expected 17, 17, and 18 damage for the first three attacks (essentially, three 18s vs. four 17s out of every seven attacks), but instead it turned out to be 17, 16, and 17.
>
> Here's the code:
>
> def getDamageFromRatio(ratio):
> ____if ratio < 0.5:
> ________damage = ratio * 2
> ________if damage < 0.1:
> ____________damage = 0.1
> ____elif ratio < 1.0:
> ________damage = (ratio - 0.5) * 10.0 + 1.0
> ____elif ratio < 2.0:
> ________damage = (ratio - 1.0) * 10.0 + 6.0
> ____elif ratio < 3.0:
> ________damage = (ratio - 2.0) * 5.0 + 16.0
> ____else:
> ________damage = (ratio - 3.0) + 21.0
> ____return damage
>
> So basically a different formula is used for each of five different ranges that the attack/defense ratio might fall within. If you do the math for the borderline cases (e.g., ratios of 2.99 and 3.0), you'll find that there are no sudden jumps or discontinuities in the damages returned by the function. But the formulas for excessively low or excessively high ratios don't yield dramatic damage values. Each time your ratio hits the next higher bracket, your returns diminish severely. For example, the difference between a ratio of 1.0 and 1.1 is twice as great as the difference between a ratio of 2.0 and 2.1 and *ten times* as great as the difference between a ratio of 3.0 and 3.1.
>
> So 15 vs 7 gives you approximately a 2.143 ratio, which makes the formula:
>
> (ratio - 2.0) * 5.0 + 16.0
>
> ...or...
>
> (2.143 - 2.0) * 5.0 + 16.0
>
> ...which is about 16.7142. To get a full 17 points of damage each attack, you'd need a ratio of 2.2.

Ahh, I see. Heh, so why did you use two "different" equations for <1.0 and <2.0?
(ratio - 0.5) * 10.0 + 1.0
and
(ratio - 1.0) * 10.0 + 6.0
are actually equivalent if you multiply out the part in parentheses. Or were those originally something different? The reason why I got it wrong was that I assumed since the same equation works for both (I was using 10*ratio - 4 myself, which is what you get if you multiply out what's in the parentheses of those two equations), it was for any range. Interesting...

Replies To This Message

Post a Reply

RinkChat Username:
Password:
Email: (optional)
Subject:
Message:
Link URL: (optional)
Link Title: (optional)

Make sure you read our message forum policy before posting.