From 037e43e1c11ea406bdc9d5fce1cbf606c83e95ef Mon Sep 17 00:00:00 2001 From: Dugy Date: Thu, 6 Jun 2024 23:58:38 +0200 Subject: [PATCH] Make the effects of the trickery and doom weapon specialls halve every turn --- lua/main.lua | 10 +++++ utils/abilities.cfg | 4 +- utils/abilities_events.cfg | 77 +++++++++++++------------------------- 3 files changed, 39 insertions(+), 52 deletions(-) diff --git a/lua/main.lua b/lua/main.lua index 2518119d..09d746fb 100644 --- a/lua/main.lua +++ b/lua/main.lua @@ -1195,3 +1195,13 @@ function wesnoth.wml_actions.set_resolve_intensity(cfg) end set_buildup_ability_intensity(cfg, "[set_resolve_intensity]", "resistance", "latent_resolve", get_resolve_intensity, generate_resolve_ability) end + +function wesnoth.wml_actions.set_elusiveness_intensity(cfg) + local function get_elusiveness_intensity(ability) + return ability.sub + end + local function generate_elusiveness_ability(intensity) + return { "chance_to_hit", { id = "latent_elusiveness", apply_to = "opponent", sub = intensity }} + end + set_buildup_ability_intensity(cfg, "[set_elusiveness_intensity]", "chance_to_hit", "latent_elusiveness", get_elusiveness_intensity, generate_elusiveness_ability) +end diff --git a/utils/abilities.cfg b/utils/abilities.cfg index 38cf2384..eb6490bf 100644 --- a/utils/abilities.cfg +++ b/utils/abilities.cfg @@ -1615,14 +1615,14 @@ Enemy units cannot see this unit during dawn or dusk, except if they have units [dummy] id=trickery name= _ "trickery" - description= _ "If this attack hits offensively, opponent's defence on all terrains is lowered by 5%, until he advances." + description= _ "If this attack hits offensively, opponent's defence on all terrains is lowered by 5%. This decrease halves every turn." [/dummy] #enddef #define WEAPON_SPECIAL_DOOM [dummy] id=doom name= _ "doom" - description= _ "If this attack hits offensively, opponent's resistances will drop by 5% until he advances." + description= _ "If this attack hits offensively, opponent's resistances will drop by 5%. This decrease halves every turn." [/dummy] #enddef #define WEAPON_SPECIAL_CONE diff --git a/utils/abilities_events.cfg b/utils/abilities_events.cfg index 22c92481..b796083b 100644 --- a/utils/abilities_events.cfg +++ b/utils/abilities_events.cfg @@ -3660,35 +3660,10 @@ [filter_attack] special_id=trickery [/filter_attack] - [object] - silent=yes - duration=forever - sort=potion_like - remove_on_heal=yes - [filter] - x,y=$x2,$y2 - [/filter] - [effect] - apply_to=defense - replace=false - [defense] - frozen=5 - castle=5 - sand=5 - village=5 - flat=5 - hills=5 - mountains=5 - swamp_water=5 - cave=5 - shallow_water=5 - reef=5 - forest=5 - fungus=5 - unwalkable=5 - [/defense] - [/effect] - [/object] + [set_elusiveness_intensity] + id=$second_unit.id + sub=5 + [/set_elusiveness_intensity] [floating_text] x,y=$x2,$y2 text="" + _ "-5% defence" + "" @@ -3700,27 +3675,10 @@ [filter_attack] special_id=doom [/filter_attack] - [object] - silent=yes - duration=forever - sort=potion_like - remove_on_heal=yes - [filter] - x,y=$x2,$y2 - [/filter] - [effect] - apply_to=resistance - replace=false - [resistance] - fire=5 - cold=5 - arcane=5 - impact=5 - blade=5 - pierce=5 - [/resistance] - [/effect] - [/object] + [set_resolve_intensity] + id=$second_unit.id + sub=5 + [/set_resolve_intensity] [floating_text] x,y=$x2,$y2 text="" + _ "-5% all resistances" + "" @@ -6109,6 +6067,25 @@ [/do] [/for] {CLEAR_VARIABLE resolve} + + [store_unit] + [filter] + side=$side_number + ability=latent_elusiveness + [/filter] + variable=elusive + [/store_unit] + [for] + array=elusive + variable=h + [do] + [set_elusiveness_intensity] + id=$elusive[$h].id + div=2 + [/set_elusiveness_intensity] + [/do] + [/for] + {CLEAR_VARIABLE elusive} [/event] [event]