StealItem¶
A method that has an enemy party member attempt to steal an item from the player's standard items inventory and returns a bool indicating if an item was actually stolen or not.
private bool StealItem(int enemyid, bool always, bool noanim)
There are 2 overloads that ends up calling the one above. The following one sends false as noanim:
private bool StealItem(int enemyid, bool always)
And this one one send false as always and false as noanim:
private bool StealItem(int enemyid)
Parameters¶
enemyid: Theenemydataof the enemy party member that will attempt the stealingalways: If true, the enemy party member will always attempt to steal if it can. If false, it will only do it ifcommandsuccessis false (meaning the last block or action command was failed)noanim: If true, the enemy party member won't have their animstate changed to 27 (ItemWalk) during the stealing if it happens
Steal conditions¶
Here are all the conditions needed for the enemy party member to actually steal:
- Either always is true or
commandsuccessis false (didn't blocked, ignores FRAMEONE) items[0]contains at least one standard item- The enemy party member doesn't already have a
holditem
Procedure¶
- If the
SecurePouchmedal is equipped, false is returned early and no stealing happens - If the conditions needed to steal mentioned above aren't fufilled, false is returned. Otherwise:
- If noanim is false, the enemy party member animstate is set to 27 (
ItemWalk) - A random valid item id among
items[0]is generated which will be the item that will be stolen - CreateHeldItem is called with the item id which initialises the enemy party member's
helditemto be a new SpriteRenderer corresponding to theitemspritesfrom the id generated childed to the enemy party member'sspriteusing thespritemarmaterial on layer 14 (Sprite) with a FaceCamera component. It also sets theholditemof the enemy party member to the item id generated - The item element is removed from
items[0] ItemStolensound plays- true is returned
- If noanim is false, the enemy party member animstate is set to 27 (