Minimum Damage Code

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

Moderator: Forum Moderators

Post Reply
BWeManX
Posts: 2
Joined: May 28th, 2020, 11:41 pm

Minimum Damage Code

Post by BWeManX »

Hello! Does anyone know where the "minimum damage code" is located at in the game files?

If you have 100% (or greater) resistance to a damage type, it still deals 1 damage. I'd like to make this 0 damage.
Soliton
Site Administrator
Posts: 1680
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: Minimum Damage Code

Post by Soliton »

"If gameplay requires it, they can be made to live on Venus." -- scott
BWeManX
Posts: 2
Joined: May 28th, 2020, 11:41 pm

Re: Minimum Damage Code

Post by BWeManX »

In other words, buried in the C++ source code?

I was hoping it'd be an easy text editor mod. Thank you for your help!
Soliton
Site Administrator
Posts: 1680
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: Minimum Damage Code

Post by Soliton »

You can edit C++ with a text editor. :D But you would need to recompile the game after that and of course you'll get out-of-sync errors if you play multiplayer with unmodified clients.
"If gameplay requires it, they can be made to live on Venus." -- scott
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Minimum Damage Code

Post by WhiteWolf »

Alternatively you could do this in WML too, by applying an attack event that temporarily sets the actual base damage to 0, if the opponent's resistance is 100%. This will actually force 0 damage from this attack.
Note that if an attack's base damage is 0, if I recall correctly, the animation will always play the "miss" animation, even if it was a hit. Namely, the engine won't display a 0-damage hit. If you want it displayed correctly, you also need to do that by hand: for example using [harm_unit] for 0, or by a floating text of 0 and playing the appropriate hit sound.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Post Reply