widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02684
Re: Meaning of the defense value
% = Modulo (integer remainder)
https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Arithmetic_operators
17/09/2014 09:39, sgrìobh wl-zocker:
> That seems indeed to be the relevant part.
>
> I do not understand what the percent signs mean, but from "m_damage =
> attack - (attack * defender->get_defense()) / 100;", I deduct that the
> defense is a relative value. I will fix it in the tutorial.
>
> Thank you for your help.
>
>
> -----Ursprüngliche Nachricht----- From: Fòram na Gàidhlig
> Sent: Tuesday, September 16, 2014 8:27 PM
> To: widelands-dev@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Widelands-dev] Meaning of the defense value
>
> Maybe this code snippet is what you're looking for - from
> src/logic/battle.cc:
>
> uint32_t const hit = game.logic_rand() % 100;
> if (hit > defender->get_evade()) {
> // Attacker hits!
> m_last_attack_hits = true;
>
> assert(attacker->get_min_attack() <= attacker->get_max_attack());
> uint32_t const attack =
> attacker->get_min_attack() +
> (game.logic_rand()
> %
> (1 + attacker->get_max_attack() - attacker->get_min_attack()));
> m_damage = attack - (attack * defender->get_defense()) / 100;
> }
>
>
>
>
> 15/09/2014 18:43, sgrìobh wl-zocker:
>> Hello together,
>>
>> I am a bit confused what the defense value of the soldier means exactly:
>> - The tutorial states that the damage is reduced by a certain value
>> (e.g. 5) for every attack that hits the soldier. But that would mean
>> that an untrained soldier would never be able to kill an Atlantean
>> soldier trained in defense (see
>> https://wl.widelands.org/wiki/SoldierLevels/). There is no percent sign
>> after the value in this table (evade has), this implies that the value
>> is absolute.
>> - On the other hand, the text below the table states that those values
>> are relative, e.g. “value 3, only 97% of damage is taken”.
>>
>> Which way is used in the game to calculate the damage a soldier takes?
>>
>> Thank you for your answer,
>>
>> wl-zocker
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~widelands-dev
>> Post to : widelands-dev@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~widelands-dev
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>>
>> No virus found in this message.
>> Checked by AVG - www.avg.com <http://www.avg.com>
>> Version: 2014.0.4765 / Virus Database: 4015/8217 - Release Date: 09/15/14
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~widelands-dev
> Post to : widelands-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~widelands-dev
> More help : https://help.launchpad.net/ListHelp
>
> _______________________________________________
> Mailing list: https://launchpad.net/~widelands-dev
> Post to : widelands-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~widelands-dev
> More help : https://help.launchpad.net/ListHelp
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2014.0.4765 / Virus Database: 4015/8227 - Release Date: 09/17/14
References