[engine] add a [damage_type] special/ability who modify the type of attack used

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
newfrenchy83
Code Contributor
Posts: 164
Joined: October 6th, 2017, 12:57 pm

[engine] add a [damage_type] special/ability who modify the type of attack used

Post by newfrenchy83 »

I open this topic to suggest adding the [damage_type] ability/weapon and I have also already posted a git request to https://github.com/wesnoth/wesnoth/pull/7003.

When we want to change the type of an attack we use [object] to apply the change for a limited duration (durtion=end tunr, scenario) or permanently (duration=forever), but it is impossible for this bias to modulate the change of type to specific conditions (fire sword that cannot function in water or opponent immune to holy water).
The case of flaming swords exists in mainline (Httt and Utbs) and I find it quite inconsistent that fighting half submerged can't render the enchantment ineffective until the possessor pulls itself out of the water.

It seems to me that the use of leadership changing attack type exists in Era of Magic, which would suggest that [damage_type] in leadership could be used there to replace quite heavy lua/wml encoding both in volume and for the processor.

Here too I invite you to discuss this idea and refer to the git request for questions on the code itself.
User avatar
Pentarctagon
Project Manager
Posts: 5496
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by Pentarctagon »

Well, they are magic after all. They may well be unaffected by water.

If one of the use cases is in Era of Magic, then it'd be good to have inferno8 comment here too.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
newfrenchy83
Code Contributor
Posts: 164
Joined: October 6th, 2017, 12:57 pm

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by newfrenchy83 »

NNot totally, because water can cooler blade and hotest of flame don't be suficient to inflige fire damage.
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by Ravana »

There could be interest in way to add multiple different damage types to one attack instead of having to copy the attack and add new type.
gfgtdf
Developer
Posts: 1431
Joined: February 10th, 2013, 2:25 pm

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by gfgtdf »

One could also argue that they are usually only standing in shallow water and not diving, so the sword is probably above the surface and thus uneffected by the water 🤔
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
hermestrismi
Posts: 607
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by hermestrismi »

Ravana wrote: March 18th, 2023, 7:34 pm There could be interest in way to add multiple different damage types to one attack instead of having to copy the attack and add new type.
wait, is that possible ?
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2337
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by Lord-Knightmare »

hermestrismi wrote: March 20th, 2023, 8:58 pm
Ravana wrote: March 18th, 2023, 7:34 pm There could be interest in way to add multiple different damage types to one attack instead of having to copy the attack and add new type.
wait, is that possible ?
Not for the time being. Might be for the next stable.
Currently, we'd have to make copy-paste attack and just change the type. Like a sword can be both a sword slash (blade) or a sword stab (pierce)
or, a flaming sword is a fire slash or blade slash.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
hermestrismi
Posts: 607
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by hermestrismi »

Lord-Knightmare wrote: March 21st, 2023, 7:47 am
hermestrismi wrote: March 20th, 2023, 8:58 pm
Ravana wrote: March 18th, 2023, 7:34 pm There could be interest in way to add multiple different damage types to one attack instead of having to copy the attack and add new type.
wait, is that possible ?
Not for the time being. Might be for the next stable.
Currently, we'd have to make copy-paste attack and just change the type. Like a sword can be both a sword slash (blade) or a sword stab (pierce)
or, a flaming sword is a fire slash or blade slash.
I asked because I tried to do smthg like that before but I didn't completely succeed (it needed a huge work to enable/disable each attack according the terrain and the secondary unit attack) . It will be a nice new function
User avatar
octalot
General Code Maintainer
Posts: 777
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by octalot »

hermestrismi wrote: March 21st, 2023, 11:32 am I asked because I tried to do smthg like that before but I didn't completely succeed (it needed a huge work to enable/disable each attack according the terrain and the secondary unit attack) . It will be a nice new function
Having a UMC author saying that they'll use it is important, one of the reasons that I've taken so long to respond to these PRs is that I'm wondering about the trade-off between added complexity vs how much will be used. (But most of the delay is that I've had something else in life using up a lot of brainpower.)
  • Would you want different types for different strikes within a single combat?
  • Would you want units to be able to change the attacks of adjacent units, leadership style?
  • What about an ability that changes the opponent's weapon in combat, similar to a "no retaliation" ability?
Changing other units' attacks is difficult, because we need method to work out what happens when two abilities try to change it to different types. That method needs to consistently return the same answer without quirks such as "the ability from the unit on the southeastern hex wins" or "the ability from the unit that was most recently recruited wins".
newfrenchy83
Code Contributor
Posts: 164
Joined: October 6th, 2017, 12:57 pm

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by newfrenchy83 »

octalotwrote:

Having a UMC author saying that they'll use it is important, one of the reasons that I've taken so long to respond to these PRs is that I'm wondering about the trade-off between added complexity vs how much will be used. (But most of the delay is that I've had something else in life using up a lot of brainpower.)

Would you want different types for different strikes within a single combat?
Would you want units to be able to change the attacks of adjacent units, leadership style?
What about an ability that changes the opponent's weapon in combat, similar to a "no retaliation" ability?
my response
Would you want different types for different strikes within a single combat? No, i don't.
Would you want units to be able to change the attacks of adjacent units, leadership style? change type of damage or alignment, yes.
What about an ability that changes the opponent's weapon in combat, similar to a "no retaliation" ability? impose change of alignment or damage typeof opponent, yes, but not impose change of weapon in mid combat.
newfrenchy83
Code Contributor
Posts: 164
Joined: October 6th, 2017, 12:57 pm

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by newfrenchy83 »

If there's one situation in core where damage_type can be useful, it's the Eastern Invasion campaign.

The holy amulet grants its wearer's weapons "arcane" damage, but in the case of a sword, if the wearer encounters an enemy resistant to arcane but not blade resistant, the sword enchantment should not not dull it, right? Using damage_type would allow the blade to deal slashing damage when arcane resistance exceeds sword resistance.

Code: Select all

#define ABILITY_WEAPON_SPECIAL_ARCANE
    [damage_type]
        id=arcane_blade
        type=arcane
        [filter_student]
        [filter_weapon]
        type=blade
        [/filter_weapon]
        [/filter_student]
        [filter_opponent]
            formula="
                self.resistance.arcane < self.resistance.blade
            "
        [/filter_opponent]
    [/damage_type]
    [damage_type]
        id=arcane_pierce
        type=arcane
        [filter_student]
        [filter_weapon]
        type=pierce
        [/filter_weapon]
        [/filter_student]
        [filter_opponent]
            formula="
                self.resistance.arcane < self.resistance.pierce
            "
        [/filter_opponent]
    [/damage_type]
    [damage_type]
        id=arcane_impact
        type=arcane
        [filter_student]
        [filter_weapon]
        type=impact
        [/filter_weapon]
        [/filter_student]
        [filter_opponent]
            formula="
                self.resistance.arcane < self.resistance.impact
            "
        [/filter_opponent]
    [/damage_type]
#enddef
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by Ravana »

That is exactly the use case I mentioned before, where one attack has multiple different damage types at the same time.

Instead of ability

Code: Select all

[attack]
type=arcane,impact
[/attack]
newfrenchy83
Code Contributor
Posts: 164
Joined: October 6th, 2017, 12:57 pm

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by newfrenchy83 »

except what in damage_type, it must choose the prevelent type who will be calculated, calculation of both type in same time will be too complicated what decide if usig arcane or impact.
User avatar
lhybrideur
Posts: 355
Joined: July 9th, 2019, 1:46 pm

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by lhybrideur »

I think in this specific case, it would be OK to have two attacks with a damage_type each. Like if you could turn on/off the amulet.
Last edited by lhybrideur on May 9th, 2023, 1:22 pm, edited 1 time in total.
User avatar
Vyncyn
Forum Regular
Posts: 514
Joined: April 6th, 2013, 5:51 pm

Re: [engine] add a [damage_type] special/ability who modify the type of attack used

Post by Vyncyn »

I would love a feature like this.
Having an easier way to set damage type opens the way for many new abilities. And if it can automatically choose the best type it would make balancing easier.

Another (less important and more complicated) feature would be to have mixed damage, e.g. a fire sword that does 50% blade and 50% fire damage at the same time.
Post Reply