- Applied the required changes to handle def as a signed char (allows for negative def)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11837 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
37d79a46de
commit
7ca3198824
@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2007/11/28
|
||||
* Applied the required changes to handle def as a signed char (allows for
|
||||
negative def)
|
||||
* Corrected skill_check_condition to not delete items right away for
|
||||
certain skills that do the deletion themselves. Fixes several skills
|
||||
consuming items twice.
|
||||
|
@ -1670,7 +1670,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
if (!flag.idef || !flag.idef2)
|
||||
{ //Defense reduction
|
||||
short vit_def;
|
||||
signed char def1 = (signed char)status_get_def(target); //Don't use tstatus->def1 due to skill timer reductions.
|
||||
signed char def1 = status_get_def(target); //Don't use tstatus->def1 due to skill timer reductions.
|
||||
short def2 = (short)tstatus->def2;
|
||||
if(battle_config.vit_penalty_type &&
|
||||
battle_config.vit_penalty_target&target->type)
|
||||
@ -1686,7 +1686,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num;
|
||||
}
|
||||
}
|
||||
if(def1 < 0 || skill_num == AM_ACIDTERROR) def1 = 0; //Acid Terror ignores only armor defense. [Skotlex]
|
||||
if(skill_num == AM_ACIDTERROR) def1 = 0; //Acid Terror ignores only armor defense. [Skotlex]
|
||||
if(def2 < 1) def2 = 1;
|
||||
}
|
||||
//Vitality reduction from rodatazone: http://rodatazone.simgaming.net/mechanics/substats.php#def
|
||||
@ -2323,7 +2323,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
|
||||
}
|
||||
|
||||
if(!flag.imdef){
|
||||
int mdef = tstatus->mdef;
|
||||
char mdef = tstatus->mdef;
|
||||
int mdef2= tstatus->mdef2;
|
||||
if(sd) {
|
||||
i = sd->ignore_mdef[is_boss(target)?RC_BOSS:RC_NONBOSS];
|
||||
|
@ -3577,7 +3577,7 @@ static signed short status_calc_flee2(struct block_list *bl, struct status_chang
|
||||
static signed char status_calc_def(struct block_list *bl, struct status_change *sc, int def)
|
||||
{
|
||||
if(!sc || !sc->count)
|
||||
return cap_value(def,0,CHAR_MAX);
|
||||
return (signed char)cap_value(def,CHAR_MIN,CHAR_MAX);
|
||||
|
||||
if(sc->data[SC_BERSERK])
|
||||
return 0;
|
||||
@ -3616,7 +3616,7 @@ static signed char status_calc_def(struct block_list *bl, struct status_change *
|
||||
if (sc->data[SC_FLING])
|
||||
def -= def * (sc->data[SC_FLING]->val2)/100;
|
||||
|
||||
return (char)cap_value(def,0,CHAR_MAX);
|
||||
return (signed char)cap_value(def,CHAR_MIN,CHAR_MAX);
|
||||
}
|
||||
|
||||
static signed short status_calc_def2(struct block_list *bl, struct status_change *sc, int def2)
|
||||
@ -3656,7 +3656,7 @@ static signed short status_calc_def2(struct block_list *bl, struct status_change
|
||||
static signed char status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef)
|
||||
{
|
||||
if(!sc || !sc->count)
|
||||
return cap_value(mdef,0,CHAR_MAX);
|
||||
return (signed char)cap_value(mdef,CHAR_MIN,CHAR_MAX);
|
||||
|
||||
if(sc->data[SC_BERSERK])
|
||||
return 0;
|
||||
@ -3677,7 +3677,7 @@ static signed char status_calc_mdef(struct block_list *bl, struct status_change
|
||||
if(sc->data[SC_INCMDEFRATE])
|
||||
mdef += mdef * sc->data[SC_INCMDEFRATE]->val1/100;
|
||||
|
||||
return (char)cap_value(mdef,0,CHAR_MAX);
|
||||
return (signed char)cap_value(mdef,CHAR_MIN,CHAR_MAX);
|
||||
}
|
||||
|
||||
static signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, int mdef2)
|
||||
@ -4111,7 +4111,7 @@ unsigned short status_get_lwatk2(struct block_list *bl)
|
||||
return status->lhw?status->lhw->atk2:0;
|
||||
}
|
||||
|
||||
unsigned char status_get_def(struct block_list *bl)
|
||||
signed char status_get_def(struct block_list *bl)
|
||||
{
|
||||
struct unit_data *ud;
|
||||
struct status_data *status = status_get_status_data(bl);
|
||||
@ -4119,8 +4119,7 @@ unsigned char status_get_def(struct block_list *bl)
|
||||
ud = unit_bl2ud(bl);
|
||||
if (ud && ud->skilltimer != -1)
|
||||
def -= def * skill_get_castdef(ud->skillid)/100;
|
||||
if(def < 0) def = 0;
|
||||
return def;
|
||||
return cap_value(def, CHAR_MIN, CHAR_MAX);
|
||||
}
|
||||
|
||||
unsigned short status_get_speed(struct block_list *bl)
|
||||
|
@ -622,7 +622,7 @@ int status_get_lv(struct block_list *bl);
|
||||
#define status_get_luk(bl) status_get_status_data(bl)->luk
|
||||
#define status_get_hit(bl) status_get_status_data(bl)->hit
|
||||
#define status_get_flee(bl) status_get_status_data(bl)->flee
|
||||
unsigned char status_get_def(struct block_list *bl);
|
||||
signed char status_get_def(struct block_list *bl);
|
||||
#define status_get_mdef(bl) status_get_status_data(bl)->mdef
|
||||
#define status_get_flee2(bl) status_get_status_data(bl)->flee2
|
||||
#define status_get_def2(bl) status_get_status_data(bl)->def2
|
||||
|
Loading…
x
Reference in New Issue
Block a user