- 积分
- 1040
- 威望
- 0
- 魅力
- 0
- 经验
- 712
- 热心度
- 0
- 注册时间
- 2010-9-12
- 最后登录
- 2024-8-7
- 主题
- 14
- 回帖
- 230
- 精华
- 0
- 阅读权限
- 40
TA的每日心情 | 开心 2024-8-7 01:57 |
---|
签到天数: 51 天 连续签到: 1 天 [LV.5]女巫

4级 Famous Hero

- 积分
- 1040
|
ZVSE
_WARNING_#1=IMPORTANT! This file is not in a plain text format. NEVER use any editor except [wiki]ERM[/wiki]_S for making any kind of changes!
ERMS_PoweredBy=ERM Scripter v. 2004.6.29.918
ERMS_ScriptDate=13.4(April).2009
** script to prevent creature experience reduction due to overflow. JHV,2/3/2009
** uses v7090-v7103 to store troop ranks @ start of battle
** uses FU459-FU462
**"The bug you describe probably occurs when the experience exceeds the maximum
**positive value that its (internal) variable can store.
**For example, one byte (8 bits) can store a number from
**0 to 255 (11111111 in binary), but it is convenient to the value stored as
**from -128 to +127, by performing the "two's complement" (change all 0's to 1's
**and 1's to 0's, then add 1) to convert a positive number to a negative number,
**because any binary number and its two's-complement sum to zero (with a carry
**that overflows out of the byte). This makes integer subtraction easy (just add
**the two's complement of the number to be subtracted), but it means that, for
**example, if you are using 1-byte storage, adding 2 to
**127 (00000010 to 01111111 in binary) produces -127 instead of 129."
**In readable words :P this bug will certainly occur when the experience received
**after a very big battle can't be handled by the game. Usually if you continue
**to play a map after the 12th month and the neutral creatures have an
**overgrowth. Your experience will go into the negative, all abilities will be
**lost and you will need certainly more than hundred battles to restore it.
**The script restore it automatically if lost.
!?BA0&1000; start of (human) battle
!!BA:H0/?v1; get attacker hero #
!!BA:H1/?v2; get defender hero # (if any)
!!DO459/0/6/1&v1>-1/v1<156:Pv1; check stacks 0-6 for attacker
!!DO460/0/6/1&v2>-1/v2<156:Pv2; check stacks 0-6 for defender
!?FU459; get exp. rank of troop in slot x16 of hero x1, store in v[7090+x16]
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!VRv5:S7090+x16;
!!VRvv5:Sy3;
!?FU460; get exp. rank of troop in slot x16 of hero x1, store in v[7097+x16]
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!VRv5:S7097+x16;
!!VRvv5:Sy3;
!?BA1&1000; end of (human) battle
!!BA:H0/?v1; get attacker hero #
!!BA:H1/?v2; get defender hero # (if any)
!!VRv3:C-1/-1; set v3 & v4 to -1
!!HEv1&v1>-1/v1<156:O?v3; get attacker's Owner - will be 0-7 if attacker won
!!HEv2&v2>-1/v2<156:O?v4; get defender's Owner - will be 0-7 if defender won
!!DO461/0/6/1&v3>-1/v3<8:Pv1; check stacks 0-6 for attacker
!!DO462/0/6/1&v4>-1/v4<8:Pv2; check stacks 0-6 for defender
!?FU461; get exp. rank of troop in slot x16 of hero x1, vs. v[7090+x16]
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!FU&y2<1:E; quit if no troops left in slot
!!VRv5:S7090+x16;
!!VRy4:Svv5;
!!HEx1&y4>y3:C0/x16/d/d/11/12; set rank to 11 if negative experience was
gained (overflow occurred)
!?FU462; get exp. rank of troop in slot x16 of hero x1, vs. v[7097+x16]
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!FU&y2<1:E; quit if no troops left in slot
!!VRv5:S7097+x16;
!!VRy4:Svv5;
!!HEx1&y4>y3:C0/x16/d/d/11/12; set rank to 11 if negative experience was
gained (overflow occurred)
!!IF&610:V616/1; |
|