magic/marksman/steadfast clarifications

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

magic/marksman/steadfast clarifications

Post by tsr »

How is the calculation done when a steadfast unit defends against an magic attack or unit with marks(wo)man?

Wich rule applies? Allways double defence up to 50% or always 70/60% chance to hit?

How is the marskman/magic used when defenders have less than 30/40 defence is 70/60 cth used anyway?

/tsr
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Wesnoth wrote:"Steadfast: This unit's resistances are doubled, up to a maximum of 50%, when defending. Vulnerabilities are not affected."
Resistances, not defense.
Wesnoth wrote:"Marksman: When used offensively, this attack always has at least a 60% chance to hit."
Either 60% or defender's natural defense, whichever grants better CTH.
Wesnoth wrote:"Magical: This attack always has a 70% chance to hit."
Straightforward. Always 70%.
Leo
Posts: 54
Joined: January 19th, 2006, 5:08 pm
Location: St.Petersburg, Russia
Contact:

Post by Leo »

1. Steadfast doubles resistance, not defence, so steadfast has no connection with marksman/magic

Magic attacks always has 70% CTH, regardless of defender's defence.
Marksman attacks has at least 60% in offence.

Action Def Magic Marks
Attack 50% 70% 60%
Defend 50% 70% 50%
Attack 20% 70% 80%
Defend 20% 70% 80%

Def = Defence of enemy

Magic = CTH using magic attack

Marks = CTH using marksman attack

Did I answered you question?
Leo
Posts: 54
Joined: January 19th, 2006, 5:08 pm
Location: St.Petersburg, Russia
Contact:

Post by Leo »

Sorry for posting another answer in parallel with zookeepers'
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

I tried to read and understand the some source files, so there are results of my (incomplete) reading:

The damage calculating algorithm in pseudocode:

Code: Select all

if your attack is MAGICAL
  chance to hit is 70%
if your attack is not magical
  chance to hit depends on opponent unit type and terrain
  but if you are MARKSMAN, it is at least 60%

base damage depends on your weapon
if you have BACKSTAB
  and you are attacking
  and backstab conditions are fulfilled
    double the damage
if you or opponent have CHARGE
  and the one with charge is attacking
    double the damage
if you are LAWFULL / CHAOTIC
  add/remove the time bonus % to/from damage
if your friendly unit on adjacent field has LEADERSHIP bonus
  and it has higher level than you
    add leadership bonus % to damage
    (if given multiple leadership bonuses, use only the highest one)
if opponent unit has STEADFAST
  remove double resistance % from damage
if opponent unit does not have steadfast
  remove resistance % from damage
if you are SLOWED
  remove 50% from damage

if you have DRAIN
  after successful attack you receive 50% of damage as hitpoints

if you or opponent have BERSERK
  and both are alive
  and not already fighting 30 rounds
    fight again

if you have PLAGUE
  and you killed your opponent
  and plague conditions are fulfilled
    a new walking corpse unit is created
If I understand it correctly, all bonuses to damage are multiplicative (that is, they never say "add X damage", only "add X% damage"), so their order in algorithm is not important.
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Post by tsr »

zookeeper wrote:
Wesnoth wrote:"Steadfast: This unit's resistances are doubled, up to a maximum of 50%, when defending. Vulnerabilities are not affected."
Resistances, not defense.
Ok, sorry about this, don't know why I didn't remember that.

Thanks!

/tsr
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

Some consequences:


If your attack is MAGICAL and your unit is MARKSMAN, it has exactly 70% chance to hit.

Please note that magical attack makes marksmanship useless... unless the unit can use the marksman ability to some other, non-magical attacks.


If you attack someone with CHARGE and BACKSTAB (and there is your friend on the opposing side of the defending unit); and you are LAWFUL during the day; and you are first level unit and there is a third level unit with LEADERSHIP on adjacent hex, and you use a holy attack against undead unit (resistance -100), and your base damage is 5, total damage would be:

Code: Select all

5
 × 2  // charge
 × 2  // backstab
 × 1.25  // +25% lawful in day
 × 1.50  // +50% leadership 2 levels higher
 × 2.00  // -100% resistance
 = 75
However, if you have none of the abilities described above; you are LAWFUL during the night, SLOWed, and you use a holy attack against a STEADFAST dwarf with resistance 20, and your base damage is 5, total damage would be:

Code: Select all

5
 × 0.75  // -25% lawful in night
 × 0.50  // -50% slowed
 × 0.60  // -2×20% steadfast + resistance
 = 1.125

Moral of the story? Well... it gives you some insight on what to do and what to avoid when you are lawful unit with holy attack, I suppose. ;-)
Leo
Posts: 54
Joined: January 19th, 2006, 5:08 pm
Location: St.Petersburg, Russia
Contact:

Post by Leo »

Some little addition to Viliam's:

Code: Select all

if your attack is not magical
  chance to hit depends on opponent unit type and terrain
  but if you are MARKSMAN AND you are attacker, it is at least 60%
MARKSMAN works only when attacking
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

Marksman, like Magical, is an attack special, not a unit ability.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Post Reply