DiD: Remove the definition of TURN_INTO_A_LICH

The only instanciation of this macro was removed in 79d97a11.
This commit is contained in:
Steve Cotton 2019-11-04 22:39:41 +01:00
parent a075a2971c
commit 80b03f1a05

View file

@ -119,147 +119,6 @@
[/event]
#enddef
# This event turns a necromancer into a lich. It can be activated by an event or from
# a right-click menu option. It needs $unit to be set or it won't do anything.
#
# Taken from Secrets of the Ancients, with the character-specific code removed.
#define TURN_INTO_A_LICH
[event]
name=lichify
first_time_only=no
# This is just to get a more descriptive name for the "unit" variable.
[set_variables]
name=stored_necromancer
mode=replace
to_variable=unit
[/set_variables]
# In DiD, only Mal Keshar himself can advance to be an Ancient Lich, and his
# transformation is handled in scenario 11. I've left the SotA AMLA calculation
# code in here, partly because it's easier to keep the code the same, and
# partly in case someone enables the fourth level for other liches.
#
# The necromancer may have AMLAd and had its experience reset to 0. Now, as a
# lich, there is a fourth level available for the unit, and all that experience
# should be applied towards the level-up instead of simply being lost. We will
# "unwind" each AMLA and calculate how much it cost, so we can give back those
# experience points.
[set_variable]
name=num_amlas
# This gives us the number of AMLAs that the unit has had:
value=$stored_necromancer.modifications.advancement.length
[/set_variable]
[set_variable]
# The experience that will be used for the new lich will be at least
# the necromancer's current actual experience.
name=experience_gained_after_max_level
value=$stored_necromancer.experience
[/set_variable]
[set_variable]
# Each AMLA took 20% more experience, so we will need to reduce this
# value as we unwind them. The variable starts out storing the amount
# needed for the *next* AMLA, so we will need to reduce it one step as
# the first operation.
name=experience_for_one_amla
value=$stored_necromancer.max_experience
[/set_variable]
[while]
[variable]
name=num_amlas
greater_than=0
[/variable]
[do]
[set_variable]
# Each AMLA increased the experience needed by 20%, which
# is the same as multiplying by 1.2. We reverse that here.
name=experience_for_one_amla
divide=1.2
[/set_variable]
[set_variable]
# Round it off in case it's a float:
name=experience_for_one_amla
round=0
[/set_variable]
[set_variable]
# Add the experience that was needed for the previous AMLA
# to the amount that will be given to the lich:
name=experience_gained_after_max_level
add=$experience_for_one_amla
[/set_variable]
[set_variable]
name=num_amlas
sub=1
[/set_variable]
[/do]
[/while]
# We are going to create a new unit instead of transforming the old one.
# Using the old unit would leave its AMLAs in effect, changing the hitpoints
# and experience needed to level up.
[unit]
side=1
type=Lich
x=$stored_necromancer.x
y=$stored_necromancer.y
id=$stored_necromancer.id
name=$stored_necromancer.name
facing=$stored_necromancer.facing
moves=$stored_necromancer.moves
overlays=$stored_necromancer.overlays
hitpoints=$stored_necromancer.hitpoints
canrecruit=$stored_necromancer.canrecruit
attacks_left=$stored_necromancer.attacks_left
experience=$experience_gained_after_max_level
# Copy the original traits into the new unit:
[modifications]
[insert_tag]
name=trait
variable=stored_necromancer.modifications.trait[0]
[/insert_tag]
[insert_tag]
name=trait
variable=stored_necromancer.modifications.trait[1]
[/insert_tag]
[/modifications]
to_variable=new_lich # Don't create the unit yet. Just store it.
[/unit]
# Hitpoints are transferred to the new unit so that turning into a lich doesn't
# heal it. However, this could result in the lich having more HP than its
# maximum. If that is the case, we will reset it to the maximum.
[if]
[variable]
name=new_lich.hitpoints
greater_than=$new_lich.max_hitpoints
[/variable]
[then]
[set_variable]
name=new_lich.hitpoints
value=$new_lich.max_hitpoints
[/set_variable]
[/then]
[/if]
[unstore_unit]
# The unit will automatically AMLA if its experience is sufficient.
# However, in this campaign only Mal Keshar himself can advance to
# be an Ancient Lich (his transformation is handled in scenario 11).
variable=new_lich
text= _ "Lich" # This text goes by quickly, so it must be short.
red,green,blue=220,0,220 # dark-magic purple
animate=yes
[/unstore_unit]
[clear_variable]
name=stored_necromancer, new_lich, num_amlas, experience_for_one_amla, experience_gained_after_max_level
[/clear_variable]
[/event]
#enddef
#define SET_GOT_INSIDE_MANOR
{MODIFY_UNIT (
side=1