← Back to team overview

widelands-dev team mailing list archive

Re: Meaning of the defense value

 

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


Follow ups

References