Fluorohydride / ygopro-core

ygopro script engine.
MIT License
327 stars 134 forks source link

fix field::recover(), field::damage() #502

Closed salix5 closed 1 year ago

salix5 commented 1 year ago

Problem

  1. The ATK, DEF are int32, but the max of damage is 0xffff.

  2. The recover may cause overflow.

Solution

  1. Now amount is put in arg3, and it is int32.

  2. Now the recover is capped at

    int32 limit = INT32_MAX - player[playerid].lp;

    If amount > limit, the system will:

    • recover limit LP
    • raise the event EVENT_RECOVER with amount