Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define WEAPON_SPECIAL_SHRAPNEL_IMPLEMENTATION
- [event]
- id=shrapnel:hit_handler
- name=attacker hits
- first_time_only=no
- [filter_attack]
- special=shrapnel
- [/filter_attack]
- {BUG_ON
- ({VARIABLE_NUMERICAL_LESS_THAN_OR_EQUAL unit.variables.shrapnel_count 0})
- ("shrapnel count <= 0 at event start!")}
- [harm_unit]
- [filter]
- [filter_adjacent]
- x,y=$x2,$y2
- adjacent=$second_unit.facing
- [/filter_adjacent]
- [/filter]
- amount=$weapon.damage
- alignment=$unit.alignment
- damage_type=$weapon.type
- kill=yes
- fire_event=yes
- animate=yes
- [/harm_unit]
- {VARIABLE_DEC unit.variables.shrapnel_count}
- [if]
- {VARIABLE_NUMERICAL_EQUALS unit.variables.shrapnel_count 0}
- #
- # Remove weapon and events.
- #
- [then]
- [object]
- silent=yes
- [filter]
- x,y=$x1,$y1
- [/filter]
- [effect]
- apply_to=remove_attacks
- name=shrapnel
- [/effect]
- [/object]
- [event]
- remove=yes
- id=shrapnel:hit_handler
- [/event]
- [/then]
- #
- # Update counter in the attack name.
- #
- [else]
- [object]
- silent=yes
- [filter]
- x,y=$x1,$y1
- [/filter]
- [effect]
- apply_to=attack
- name=shrapnel
- set_description="$unit.variables.shrapnel_name ($unit.variables.shrapnel_count)"
- [/effect]
- [/object]
- [/else]
- [/if]
- [/event]
- #enddef
Advertisement
Add Comment
Please, Sign In to add comment