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¶
actionis set to true switching to an uncontrolled flow- UpdateText is called
- The
ItemHoldsounds is played lastitemuseris set to thetrueidof thecurrentturnplayer 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 thecurrentturnplayer party member's battleentity's position + itscursoroffset- (0.0, 0.0, 0.1) - The
currentturnplayer 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
Slash2sound 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 theGleamparticles and sound - 0.5 seconds are yielded
- The
Slashsound 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
ItemStolensound 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
actionis 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
deadmembersis set to GetDeadParty which is all player party member indexes whosehpis 0 or below in ascending order- The
currentturnplayer 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
optionplayer 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].cursoroffsetand 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].cursoroffsetand 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].cursoroffsetand 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
optionplayer party member with the ammount being the returned value of DoItemEffect - 34%: DoDamage is called without an attacker to the
optionplayer party member with the damageammount being the returned value of DoItemEffect with aNoExceptionsproperty and without block
- 66%: Heal is called on the
- The
hpof theoptionplayer 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
mothicenormalparticle are played without sound at theoptionplayer party member's battleentity's position + Vector3.up all scaled by (1.5, 1.5, 1.5) - If the
optionplayer party member has a Freeze ondition and its battleentity.icecubeis 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
optionplayer 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
optionplayer party member'sisnumbis set to false - The
CurePoisoneffects applies
CureFreeze¶
- BreakIce is called on the
optionplayer party member's battleentity - The
CurePoisoneffects applies
CureSleep¶
- The
optionplayer party member'sisasleepis set to false - The
CurePoisoneffects applies
CureParty¶
- For each player party members that isn't
eatenbyand has anhpabove 0:isnumbis set to false- BreakIce is called on the battleentity
isasleepis set to false
- The
CurePoisonAlleffects applies
CurePoison, GradualHP, GradualTP, CureFire or CureAll¶
- The
MagicUpparticle are played without sound at theoptionplayer party member's battleentity's position - If there's more than 1 effect, 0.5 seconds are yielded before processing more
CurePoisonAll¶
- The
MagicUpparticle are played without sound at each of the player party members's battleentity's position who isn'teatenbyand whosehpis above 0 - If there's more than 1 effect, 0.5 seconds are yielded before processing more
ChargeUp¶
- The
StatUpsound is played - StatEffect is called with the
optionplayer 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
optionplayer party member'smaxhp- 1 starting at its battleentity's position and ending at (-1, 2.0, 0.0) - DoDamageAnim is called with the
optionplayer 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
optionplayer 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
optionplayer 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:
HardSeedSpicyBombPoisonBombClearBombNumbDartIceFrostBombNumbBombSleepBombAbombhoneyPoisonDartCherryBombBurlyBombFlameRock
Post item effects¶
- If the
ItemRecyclemedal 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 theItemRecyclemedal 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.lastpromptas the index which is basically the ItemList'soptionvalue 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
currentturnparty member using the action id set to trigger earlier
- currentaction is set to
- Otherwise:
- 0.5 seconds are yielded
- EndPlayerTurn is called
actionis set to false switching to a controlled flow