LeafbugNinja¶
Assumptions¶
It is assumed this enemy is loaded with a non empty chargeonotherenemy as it is needed for their hitaction logic to work. Typically, it will be set to other LeafbugNinja, LeafbugArcher and LeafbugClubber.
About the clones special logic¶
This enemy is able to summon clones of themselves in the post move logic, but with a special property: their weakness is set to be one element being DieInOneHit. This not only changes the damage pipeline such that their hp is unconditionally set to 0 upon any DoDamage calls, but it allows this action to tell that they are indeed a clone. This assumes that this enemy's data does NOT contain this property in the weakness field as it would otherwise break this system.
Clones have very reduced logic as besides the hitaction logic and the initialisation of data (which won't do anything for them), they do not share the logic of the original enemy who summoned them. If at the start of the action, their hitaction is false, but they have the DieInOneHit in their weakness, the ENTIRE action logic is reduced to this:
- The nocharm local is set to true which will prevent any UseCharm calls to occur in the post action phase. This means no
HealHPcharm can occur after this action
This means the clones cannot perform any moves, summons other clones or do anything practical besides their hitaction logic. Only the original enemy who summoned them can have access to the full action logic.
data usage¶
At the start of the action, if data is null or empty, it's initialised to be 1 element with a starting value of 0.
data[0]: When this is 0, the cloning setup won't be done in the post move logic unless this enemy is the last remaining enemy party member. Once the cloning setup is performed for the first time, it is set to 1. When this happens, the cloning setup will always be performed in the post move logic even if there are more than 1 enemy party members including this enemy
HardMode changes¶
HardMode being true does the following changes:
- In the leaf projectiles throw move, there is now a 5/10 chance for the Projectile property to be Poison instead of Pierce. When this happens, the projectile has a color of pure magenta
- In the leaf projectiles throw move, the speed of each Projectile changes to 27.0 from 36.0
hitaction support¶
This enemy supports hitaction logic and it will be performed when hitaction is true instead of any moves. This logic is supported by the clones, but it's only for visual effects in this case as the charge gained won't be useful to them.
dontusecharge set to true¶
This move always sets dontusecharge to true which means charges will not get zeroed out in post action.
Logic sequence¶
This is done by yield returning the EnemyAngryCharge coroutine with the battleentity. It does the following:
- Set
dontusechargeto true - If
chargeis less than 3, it is incremented with the following:- animstate set to 5 (
Angry) Wamsound plays- Emoticon called on this enemy with the
Exclamationemote with 20 time - Yield all frames until
emoticoncooldownexpires StatUpsound plays- StatEffect called on this enemy with type 4 (green up arrow)
- Yield for 0.5 seconds
chargeis incremented
- animstate set to 5 (
Move selection¶
2 moves are possible:
- A single target kick attack
- A multiple targets leaf projectiles throw
The decision of which move to use is based on the following odds:
| Move | Odds |
|---|---|
| 1 | 3/5 |
| 2 | 2/5 |
Post move logic¶
The following logic concerns the cloning setup and it is always done after a move, but only if at least one of the following is true:
- This enemy is the last
enemydataremaining data[0]is 1 (meaning this cloning setup was used before)
If these requirements are fufilled, the cloning logic happens:
chargeset to 0- UpdateEntities called
data[0]set to 1 (allows this cloning setup to be done again even if there are more than 1 enemy party members)- If there are less than 3
enemydata:- animstate set to 104
- Yield for 0.5 seconds
- Done 2 times as long as there are less than 3
enemydata:checkingdeadis set to a new SummonEnemy call to summon anotherLeafbugNinjawith typeNoneat a random location between (0.25, 0.0, -0.75) and (7.0, 0.0, 0.75) where the distance between any enemy party member is less than itssize* 1.75 with cantmove (meaning the enemy needs to wait on the next main turn to act)- Yield all frames until
checkingdeadis null LeafClonesound plays- DeathSmoke particles plays at
enemydata[lastaddedid]position with a size of (1.5, 2.5, 1.5) - The fields of
enemydata[lastaddedid]gets adjusted:- weakness: DieInOneHit
hp: This enemy'shpdestroytype: NinjaLogmoney: 0exp: 0- diebyitself: true
charge: This enemy'scharge- condition: This enemy's
condition
- Yield for 0.5 seconds
- UpdateEntities called
LeafCloneShufflesound plays- From there, there are 3 position vectors that the 3 enemy party members will end up, but who will go where is determined randomly with this enemy being the first whose position will be determined. Here are the 3 position vectors:
- (1.0, 0.0, 0.0)
- (3.5, 0.0, 0.0)
- (6.0, 0.0, 0.0)
- startp is set to a random position vector among the 3 which determines the position vector of this enemy. This also determines the position vector of the other 2 enemy party members: the first free position vector will be assigned to the first
enemydatathat isn't this enemy and the last remaining one will be assigned to the remainingenemydata - For every enemy party members:
- If this isn't this enemy, their
hpis set to this enemy'shp - They MoveTowards (3.5, 0.0, 0.0) with a 2.0 multiplier and 1 (
Walk) as walkstate and stopstate - Their y
spinset to 30.0
- If this isn't this enemy, their
- Yield all frames until the first 3
enemydata'sforcemoveare all done - Yield for 0.5 seconds
- For each enemy party members:
- Their
spingets zeroed out - Their
flipgets set to false - They get FlipAngle called with setangle
- They MoveTowards their respective position vector with a 2.0 multiplier
- Their
- Yield all frames until the first 3
enemydata'sforcemoveare all done - This enemy position set to startp
- For every enemy party members, their
chargeis reset to 0
Move 1 - Kick attack¶
A single target kick attack.
DoDamage calls¶
| # | Conditions | attacker | target | damageammount | property | overrides | block |
|---|---|---|---|---|---|---|---|
| 1 | Always happen | This enemy | playertargetID after GetSingleTarget |
2 | null | null | commandsuccess |
Logic sequence¶
- GetSingleTarget called
- Camera moves to look near
playerdata[playertargetID] - MoveTowards
playertargetentityposition + (1.25, 0.0, -0.1) with a 3.0 multiplier - Yield all frames until
forcemoveis done ChargeDown2sound plays with 1.1 pitch- animstate set to 100
- Yield for 0.5 seconds
- animstate set to 101
ChargeDown2sound playsHit3sound plays- DoDamage 1 call happens
LeafFlipBacksound plays- SetDefaultCamera called
- animstate set to 102
- z
spinset to -30.0 - Over the course of 41.0 frames, this enemy moves from its position + 1.0 in y to startp + 1.0 in y via a BeizierCurve3 with a ymax of 5.5
spinzeroed out- animstate set to 1 (
Walk) - FlipAngle called with setangle
spriteangle zeroed out- position set to startp
- Yield for 0.5 seconds
Move 2 - Leaf projectiles throw¶
A multiple targets leaf projectiles throw.
nonphyscal set to true¶
This move always sets nonphyscal to true which affects the effects of the FrostBite, SpikeBod and PoisonTouch medal if equipped on the target.
Projectile calls¶
| # | Conditions | damage | property | attacker | playertarget | obj | speed | height | extraargs | destroyparticle | audioonhit | audiomoving | spin | nosound |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Always happen 2 times, but each calls requires that at least 1 player party member is alive (hp above 0 and not eatenby) |
2 | Pierce1 (if hardmode is true, this has 5/10 chance to be Poison instead) | This enemy | playertargetID after GetSingleTarget |
A new sprite object childed to the battlemap using the projectilepsrites[13] sprite (leaf projectile) positioned at this enemy + (-1.0, 1.0, -0.1) with a scale of 0.65x and a z angle of -90.0. If the property is Poison, the SpriteRenderer's material color is pure magenta |
36.0 (27.0 instead if hardmode is true) | 0.0 | null | null | null | null | Vector3.zero | false |
1: Enemy piercing damages are disabled so this property does nothing, see the CalculateBaseDamage documentation to learn more
Logic sequence¶
- animstate set to 100
- Yield for 0.5 seconds
- Done 3 times as long as at least 1 player party member is alive (
hpabove 0 and not eatenby):- GetSingleTarget called
- animstate set to 103
Toss3sound plays- A new sprite object is created childed to the
battlemapusing theprojectilepsrites[13]sprite (leaf projectile) positioned at this enemy + (-1.0, 1.0, -0.1) with a scale of 0.65x and a z angle of -90.0 - If hardmode is true and a 5/10 RNG check passes, the property of the Projectile 1 call will be
Poisonand the sprite object's SpriteRenderer's material color is set to pure magenta - Projectile 1 call happens
- Yield for 0.25 seconds
- animstate set to 100
- Yield all frames until the sprite object is null (Projectile 1 call completed)
- animstate set to 100
- Yield for 0.25 seconds
- Yield for 0.5 seconds