diff --git a/units/Forester.cfg b/units/Forester.cfg index 5320bd14..4004cc79 100644 --- a/units/Forester.cfg +++ b/units/Forester.cfg @@ -21,7 +21,32 @@ Due to their solitude, they lack any relation to other humans, and so they do not have any problem to kill anyone they do not like. This lack of understanding can be exploited by bandits, who occasionally persuade them to join their cause." die_sound={SOUND_LIST:HUMAN_DIE} {DEFENSE_ANIM_RANGE "units/human-outlaws/ranger-sword-defend-2.png" "units/human-outlaws/ranger-sword-defend-1.png" {SOUND_LIST:HUMAN_HIT} melee } - {DEFENSE_ANIM_RANGE "units/human-outlaws/ranger-bow-defend.png" "units/human-outlaws/ranger-bow.png" {SOUND_LIST:HUMAN_HIT} ranged } + [defend] + start_time=-126 + [filter_attack] + range=ranged + [/filter_attack] + [if] + hit_sound_start_time=-25 + hits=hit + [frame] + image=units/human-outlaws/ranger-bow-defend.png:1,units/human-outlaws/ranger-bow.png:250,units/human-outlaws/ranger-bow-defend.png:1 + [/frame] + [hit_sound_frame] + sound={SOUND_LIST:HUMAN_HIT} + [/hit_sound_frame] + [/if] + [else] + hit_sound_start_time=-25 + hits=miss + [frame] + image=units/human-outlaws/ranger-sword-attack1.png:100,units/human-outlaws/ranger-sword-attack2.png:250,units/human-outlaws/ranger-sword-attack3.png:100 + [/frame] + [hit_sound_frame] + sound=dagger-swish.wav + [/hit_sound_frame] + [/else] + [/defend] [portrait] size=400 @@ -254,6 +279,25 @@ Due to their solitude, they lack any relation to other humans, and so they do no [/effect] {AMLA_DEFAULT_BONUSES} [/advancement] + [advancement] + max_times=1 + id=reflect + description= _ "able to deflect enemy shots to hit enemies when they miss" + image=attacks/sword-human.png + strict_amla=yes + require_amla="sword" + [effect] + apply_to=attack + name=bow + increase_damage=-1 + remove_specials=marksman + [set_specials] + mode=append + {WEAPON_SPECIAL_REFLECTS} + [/set_specials] + [/effect] + {AMLA_DEFAULT_BONUSES} + [/advancement] [advancement] max_times=1 always_display=yes @@ -387,4 +431,4 @@ Due to their solitude, they lack any relation to other humans, and so they do no {AMLA_DEFAULT_BONUSES} [/advancement] ) "Forester"} -[/unit_type] \ No newline at end of file +[/unit_type] diff --git a/utils/abilities.cfg b/utils/abilities.cfg index a2c4ac03..6b8e5084 100644 --- a/utils/abilities.cfg +++ b/utils/abilities.cfg @@ -1541,6 +1541,13 @@ Enemy units cannot see this unit during dawn or dusk, except if they have units description= _ "When a defender target misses, the attacker will hit him without any checks." [/dummy] #enddef +#define WEAPON_SPECIAL_REFLECTS + [dummy] + id=reflects + name= _ "reflects" + description= _ "Causes opponents's attacks to hit the opponent when the opponent misses." + [/dummy] +#enddef #define WEAPON_SPECIAL_PIERCE [dummy] id=pierce diff --git a/utils/abilities_events.cfg b/utils/abilities_events.cfg index 13c99e4e..cb7003f3 100644 --- a/utils/abilities_events.cfg +++ b/utils/abilities_events.cfg @@ -1711,6 +1711,122 @@ {CLEAR_VARIABLE has_leech,has_drain,healed,damage_dealt} [/event] + [event] + name=defender misses + first_time_only=no + [filter_attack] + special_id=reflects + [/filter_attack] + {VARIABLE has_slow no} + {VARIABLE has_poison no} + [if] + [variable] + name=second_weapon.specials.poison.id + equals=poison + [/variable] + [then] + {VARIABLE has_poison yes} + [/then] + [/if] + [if] + [variable] + name=second_weapon.specials.slow.id + equals=slow + [/variable] + [then] + {VARIABLE has_slow yes} + [/then] + [/if] + [set_variable] + name=resistance + to_variable="unit.resistance.$weapon.type" + [/set_variable] + {VARIABLE damage_to_deal $second_weapon.damage} + [if] + [variable] + name=unit.status.slowed + equals=yes + [/variable] + [then] + {VARIABLE_OP damage_to_deal divide 2} + [/then] + [/if] + {VARIABLE damage_dealt "$($($damage_to_deal*$resistance)/100)"} + [harm_unit_loti] + [filter] + x,y=$x2,$y2 + [/filter] + [filter_second] + x,y=$x1,$y1 + [/filter_second] + amount=$damage_to_deal + damage_type=$weapon.type + poisoned=$has_poison + slowed=$has_slow + fire_event=yes + fire_attacker_hits=true + [/harm_unit_loti] + {CLEAR_VARIABLE resistance,has_slow,has_poison,damage_to_deal} + [/event] + + [event] + name=attacker misses + first_time_only=no + [filter_second_attack] + special_id=reflects + [/filter_second_attack] + {VARIABLE has_slow no} + {VARIABLE has_poison no} + [if] + [variable] + name=weapon.specials.poison.id + equals=poison + [/variable] + [then] + {VARIABLE has_poison yes} + [/then] + [/if] + [if] + [variable] + name=weapon.specials.slow.id + equals=slow + [/variable] + [then] + {VARIABLE has_slow yes} + [/then] + [/if] + [set_variable] + name=resistance + to_variable="second_unit.resistance.$weapon.type" + [/set_variable] + {VARIABLE damage_to_deal $second_weapon.damage} + [if] + [variable] + name=second_unit.status.slowed + equals=yes + [/variable] + [then] + {VARIABLE_OP damage_to_deal divide 2} + [/then] + [/if] + {VARIABLE damage_dealt "$($($damage_to_deal*$resistance)/100)"} + [harm_unit_loti] + [filter] + x,y=$x1,$y1 + [/filter] + [filter_second] + x,y=$x2,$y2 + [/filter_second] + amount=$damage_to_deal + damage_type=$weapon.type + poisoned=$has_poison + slowed=$has_slow + fire_event=yes + fire_attacker_hits=true + [/harm_unit_loti] + {CLEAR_VARIABLE resistance,has_slow,has_poison,damage_to_deal} + [/event] + [event] name=side turn first_time_only=no