ReviveEnemy¶
A method specifically made for enemy actions that allows to bring back an enemy party member that was in reservedata back to enemydata with a certain percentage of hp left and the optional ability to be able to act immediately after the revive.
private void ReviveEnemy(int reserveid, float hppercent, bool canmove, bool showCounter = false)
Parameters¶
reserveid: Thereservedataindex of the enemy party member to revivehppercent: Determines thehpvalue to leave the revive enemy at. The exact number depends on the specific value (the finalhpvalue is always clamped from 0 to themaxhp):- Above 1.0: The value is the same as the parameter's value
- Any other values: The value represents the fraction of
hpto leave the enemy party member with over itsmaxhpceiled. It should be at least above 0.0 to not have the enemy party member revive with 0hpwhich may cause undesired behaviors
canmove: If true, thecantmoveof the enemy party member after the revive will be set to 0 (one actor turn available). If it's false, it will be set to 1 (no actur turns available until the next main turn)showcounter: If true, ShowDamageCounter will be called to show an hp counter sbowing the newhpamount used to revive the enemy party member along with aHealsound playing
Procedure¶
- The enemy party member in
reservedatawith index reserveid is removed, but added to the end of ofenemydata - The now revived enemy party member has these fields set on them:
hp: Set accoring to hppercent. See the hppercent parameter desctiption above for detailsexp: 0money: 0cantmove: 1 (0 instead if canmove is true)turnssincedeath: 0turnsalive: 0hitaction: false
- ClearStatus called on the now revived enemy party member
- Revive called on the
battleentitiyof the now revived enemy party member - If showcounter is true:
- ShowDamageCounter called with type 1 (HP) on the enemy party member with the ammount being their new
hpstarting at their position + 2.0 in y and ending at Vector3.up Healsound played
- ShowDamageCounter called with type 1 (HP) on the enemy party member with the ammount being their new
- The now revived enemy party member's
alreadycountedis set to true (so the amount defeated doesn't go up again in the bestiary if they die again) - ReorganizeEnemies called with order