UseItem¶
This action coroutine allows the player party member to use an item. It receives its id in a parameter which should corresponds to the one that was selected during GetChoiceInput after passing the CheckItemUse check.
Setup¶
action
is set to true switching to an uncontrolled flow- UpdateText is called
- The
ItemHold
sounds is played lastitemuser
is set to thetrueid
of thecurrentturn
player party member- A new temporary item object is created with a SpriteRenderer using the corresponding item's sprite from items data using the standard spritemat with a renderQueue of 50000 on layer 14 (
Sprite
). The object is positioned at thecurrentturn
player party member's battleentity's position + itscursoroffset
- (0.0, 0.0, 0.1) - The
currentturn
player party member's battleentity.animstate is set to 4 (ItemGet
)
BanditLeader
specific logic¶
This coroutine has special logic if a BanditLeader
enemy is present in the enemy party. When that happens, this coroutine will not apply any item effects and it will instead end abruptly with a yield break after some animations and cleanup logic. This logic is what this section is about. It doesn't apply if no BanditLeader
is present.
If it does apply, the enemy party member index of the first BanditLeader
is saved locally and used for this section.
- 0.25 seconds are yielded
- The
BanditLeader
's battleentity.animstate is saved locally for restore later - HealConditions is called on the
BanditLeader
- UpdateAnim is called
- The
BanditLeader
's battleentity.animstate is set to 103 - The
Slash2
sound is played - 0.5 seconds are yielded
- Gleam is called on the
BanditLeader
's battleentity using the offset (-0.4, 2.35, -0.1) which plays theGleam
particles and sound - 0.5 seconds are yielded
- The
Slash
sound is played - The
BanditLeader
's battleentity.animstate is set to 107 - MainManager.FadeIn is called with a speed of 1.0 (which makes the screen go to black instantly)
- 0.25 seconds are yielded
- ItemDrop is called on the temporary item object which will do the following:
- The object gets rooted to the scene
- A RigidBody component is added with a velocity of RandomItemBounce(5.0, 12.5)
- The object is destroyed in 1.0 second
- The
currentturn
's battleentity.animstate is set to 11 (Hurt
) - MainManager.FadeOut is called with a speed of 1.0 (which makes the screen go back to what it was before the fade in instantly)
- The
ItemStolen
sound is played - 0.65 seconds are yielded
- The
BanditLeader
's battleentity.animstate is restrored to the saved value - The first occurence of the item corresponding to the sent id is removed from instance.
items[0]
(standard items) - CancelList is called
- UpdateAnim is called
- UpdateText is called
- EndPlayerTurn is called
action
is set to false switching to a controlled flow- Yield break which ends this coroutine
Pre item effects¶
This section happens if the BanditLeader
specific logic didn't apply.
- 1.3 seconds are yielded
- The temporary item object is destroyed
deadmembers
is set to GetDeadParty which is all player party member indexes whosehp
is 0 or below in ascending order- The
currentturn
player party member's battleentity.animstate is set to 13 (BattleIdle
) - UpdateAnim is called
Item effects¶
This section depends on the itemarea.
SingleAlly
or AllParty
¶
This first starts by having all frames yielded while PartyIsDying which means that at least one player party member's hp
is 0 or below while its battleentity.deathroutine
is still in progress.
From there, the ItemUse elements of the item are processed by first calling DoItemEffect with the element's information and option
as the characterid.
After, there's additional logic depending on the ItemUsage.
HPRecover
or HPRecoverFull
¶
- HealParticle is called on the
option
player party member with a size of Vector3.one and an offset of Vector3.up - ShowDamageCounter is called with type 1 (HP) with the ammount being the return of DoItemEffect starting at the
playerdata[option].battleentity
's position +playerdata[option].cursoroffset
and ending at Vector3.up - If there's more than 1 effect, 0.5 seconds are yielded before processing more
Revive
¶
The same than HPRecover
or HPRecoverFull
, but if the option
player party member's battleentity is dead
, RevivePlayer is called with its id for -1 hp and showcounter as false.
TPRecover
or TPRecoverFull
¶
- ShowDamageCounter is called with type 2 (TP) with the ammount being the return of DoItemEffect starting at the
playerdata[option].battleentity
's position +playerdata[option].cursoroffset
and ending at Vector3.up - If there's more than 1 effect, 0.5 seconds are yielded before processing more
HPRecoverAll
¶
This effect applies to each player party member that isn't eatenby
and has an hp
above 0:
- HealParticle is called on the player party member with a size of Vector3.one and an offset of Vector3.up
- ShowDamageCounter is called with type 1 (HP) with the ammount being the return of DoItemEffect starting at the
playerdata[option].battleentity
's position +playerdata[option].cursoroffset
and ending at Vector3.up
If at least one player party member was affected and there's more than 1 effect, 0.5 seconds are yielded before processing more.
ReviveAll
¶
The same than HPRecoverAll
, but it also affects player party members with an hp
of 0 or below and if its battleentity is dead
, RevivePlayer is called with its id for -1 hp and showcounter as false.
HPorDamage
¶
- An RNG check is performed with 2 possible outcomes at 66% and 34% respectively:
- 66%: Heal is called on the
option
player party member with the ammount being the returned value of DoItemEffect - 34%: DoDamage is called without an attacker to the
option
player party member with the damageammount being the returned value of DoItemEffect with aNoExceptions
property and without block
- 66%: Heal is called on the
- The
hp
of theoption
player party member is clamped from 1 to itsmaxhp
- If there's more than 1 effect, 0.5 seconds are yielded before processing more
Battle
¶
An action may be set to trigger in the post item effect section depending on the item id:
VitalitySeed
: 14GenerousSeed
: 15ShellOil
: 33
AddPoison
¶
The PoisonEffect
particle are played without sound at the option
player party member's battleentity's position.
AddNumb
¶
The ElecFast
particle are played without sound at the option
player party member's battleentity's position + Vector3.up all scaled by (1.5, 1.5, 1.5).
AddFreeze
¶
- The
mothicenormal
particle are played without sound at theoption
player party member's battleentity's position + Vector3.up all scaled by (1.5, 1.5, 1.5) - If the
option
player party member has a Freeze ondition and its battleentity.icecube
is null or inactive, Freeze is called on the battleentity
AddSleep
¶
DeathSmoke particles are played at the option
player party member's battleentity's position
TurnNextTurn
¶
- StatEffect is called with the
option
player party member's battleentity with type 5 (orange up arrow) - If there's more than 1 effect, 0.5 seconds are yielded before processing more
CureNumb
¶
- The
option
player party member'sisnumb
is set to false - The
CurePoison
effects applies
CureFreeze
¶
- BreakIce is called on the
option
player party member's battleentity - The
CurePoison
effects applies
CureSleep
¶
- The
option
player party member'sisasleep
is set to false - The
CurePoison
effects applies
CureParty
¶
- For each player party members that isn't
eatenby
and has anhp
above 0:isnumb
is set to false- BreakIce is called on the battleentity
isasleep
is set to false
- The
CurePoisonAll
effects applies
CurePoison
, GradualHP
, GradualTP
, CureFire
or CureAll
¶
- The
MagicUp
particle are played without sound at theoption
player party member's battleentity's position - If there's more than 1 effect, 0.5 seconds are yielded before processing more
CurePoisonAll
¶
- The
MagicUp
particle are played without sound at each of the player party members's battleentity's position who isn'teatenby
and whosehp
is above 0 - If there's more than 1 effect, 0.5 seconds are yielded before processing more
ChargeUp
¶
- The
StatUp
sound is played - StatEffect is called with the
option
player party member's battleentity with type 4 (green up arrow) - If there's more than 1 effect, 0.5 seconds are yielded before processing more
GradualHPParty
¶
The MagicUp
particle are played without sound at each of the player party members's battleentity's position who isn't eatenby
and whose hp
is above 0
HPto1
¶
- ShowDamageCounter is called with type 0 (Damage) with the ammount being the
option
player party member'smaxhp
- 1 starting at its battleentity's position and ending at (-1, 2.0, 0.0) - DoDamageAnim is called with the
option
player party member with a damage of itsmaxhp
- 1 without block - If there's more than 1 effect, 0.5 seconds are yielded before processing more
AtkUpStat
¶
- StatusEffect is called with the
option
player party member using the AttackUp condition with the amount of turns being the returned value from DoItemEffect with effect being true - If there's more than 1 effect, 0.5 seconds are yielded before processing more
DefUpStat
¶
- StatusEffect is called with the
option
player party member using the DefenseUp condition with the amount of turns being the returned value from DoItemEffect with effect being true - If there's more than 1 effect, 0.5 seconds are yielded before processing more
Sturdy
¶
- flagvar 0 is set to the returned value from DoItemEffect
- The action id 33 is set to trigger in the post item effects section
SingleEnemy
, AllEnemies
or All
¶
An action will may be set to trigger in the post item effects section depending on the item id:
LonglegSummoner
: The -2 action id will be set to trigger- If the item id is in the following list, the 9 action id will be set to trigger:
HardSeed
SpicyBomb
PoisonBomb
ClearBomb
NumbDart
Ice
FrostBomb
NumbBomb
SleepBomb
Abombhoney
PoisonDart
CherryBomb
BurlyBomb
FlameRock
Post item effects¶
- If the
ItemRecycle
medal is equipped and a 31% RNG check passes:- The item will not be removed and instead, the ItemSpinAnim coroutine is yield returned with a position of
playerdata[currentturn]
's position + 1.0 in y, a sprite being theItemRecycle
medal icon and with playsound
- The item will not be removed and instead, the ItemSpinAnim coroutine is yield returned with a position of
- Otherwise:
- The item is removed from instance.
items[0]
(standard items) using MainManager.lastprompt
as the index which is basically the ItemList'soption
value set upon confirmation
- The item is removed from instance.
- CancelList is called
- UpdateAnim is called
- UpdateText is called
- If an action was set to trigger after the item use:
- currentaction is set to
ItemList
- DoAction is called with the
currentturn
party member using the action id set to trigger earlier
- currentaction is set to
- Otherwise:
- 0.5 seconds are yielded
- EndPlayerTurn is called
action
is set to false switching to a controlled flow