- NPC_POWERUP now gives +40% atk per level.

- Water elementals can be frozen again.
- Fixed the sc_def equation in status_change_start
- Fixed an extra semi-colon that broke win32 compiles.
- Some rewriting of bounds checks in @baselvup, @joblvup and the # equivalents to prevent signed/unsigned comparisons.
- Now slaves give exp/loot (exception: player slaves still stick to the old rules)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5267 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-02-13 15:04:11 +00:00
parent 47a3e1ca19
commit cf059ff1a9
8 changed files with 64 additions and 58 deletions

View File

@ -4,6 +4,15 @@ 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. EVERYTHING ELSE
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
2006/02/13
* NPC_POWERUP now gives +40% atk per level. [Skotlex]
* Water elementals can be frozen again. [Skotlex]
* Fixed the sc_def equation in status_change_start. [Skotlex]
* Fixed an extra semi-colon that broke win32 compiles. [Skotlex]
* Some rewriting of bounds checks in @baselvup, @joblvup and the #
equivalents to prevent signed/unsigned comparisons. [Skotlex]
* Now slaves give exp/loot (exception: player slaves still stick to the old
rules of no exp/loot) [Skotlex]
2006/02/12
* Some path cleanups meant to get the CELL_NOSTACK mod working better with
path searching and the like. [Skotlex]

View File

@ -2680,7 +2680,7 @@ int atcommand_baselevelup(
clif_displaymessage(fd, msg_table[47]); /* Base level can't go any higher. */
return -1;
} /* End Addition */
if (level > pc_maxbaselv(sd) || level > (pc_maxbaselv(sd) - (int)sd->status.base_level)) // fix positiv overflow
if (level > pc_maxbaselv(sd) || level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
level = pc_maxbaselv(sd) - sd->status.base_level;
for (i = 1; i <= level; i++)
sd->status.status_point += (sd->status.base_level + i + 14) / 5;
@ -2697,10 +2697,11 @@ int atcommand_baselevelup(
clif_displaymessage(fd, msg_table[158]); /* Base level can't go any lower. */
return -1;
}
if (level < -(int)pc_maxbaselv(sd) || level < (1 - (int)sd->status.base_level)) /* fix negativ overflow */
level = 1 - sd->status.base_level;
level*=-1;
if (level >= sd->status.base_level)
level = sd->status.base_level-1;
if (sd->status.status_point > 0) {
for (i = 0; i > level; i--)
for (i = 0; i > -level; i--)
sd->status.status_point -= (sd->status.base_level + i + 14) / 5;
if (sd->status.status_point < 0)
sd->status.status_point = 0;
@ -2739,7 +2740,7 @@ int atcommand_joblevelup(
clif_displaymessage(fd, msg_table[23]); // Job level can't go any higher.
return -1;
}
if (level > pc_maxjoblv(sd) || level > (pc_maxjoblv(sd) - (int)sd->status.job_level)) // fix positiv overflow
if (level > pc_maxjoblv(sd) || level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
level = pc_maxjoblv(sd) - sd->status.job_level;
sd->status.job_level += level;
clif_updatestatus(sd, SP_JOBLEVEL);
@ -2754,13 +2755,14 @@ int atcommand_joblevelup(
clif_displaymessage(fd, msg_table[159]); // Job level can't go any lower.
return -1;
}
if (level < -(int)pc_maxjoblv(sd) || level < (1 - (int)sd->status.job_level)) // fix negativ overflow
level = 1 - sd->status.job_level;
sd->status.job_level += level;
level *=-1;
if (level >= sd->status.job_level) // fix negativ overflow
level = sd->status.job_level-1;
sd->status.job_level -= level;
clif_updatestatus(sd, SP_JOBLEVEL);
clif_updatestatus(sd, SP_NEXTJOBEXP);
if (sd->status.skill_point > 0) {
sd->status.skill_point += level;
sd->status.skill_point -= level;
if (sd->status.skill_point < 0)
sd->status.skill_point = 0;
clif_updatestatus(sd, SP_SKILLPOINT);

View File

@ -1262,7 +1262,8 @@ int charcommand_baselevel(
clif_displaymessage(fd, msg_table[91]); // Character's base level can't go any higher.
return 0;
} // End Addition
if (level > pc_maxbaselv(pl_sd) || level > (pc_maxbaselv(pl_sd)- (int)pl_sd->status.base_level)) // fix positiv overflow
if ((unsigned int)level > pc_maxbaselv(pl_sd) ||
pl_sd->status.base_level > pc_maxbaselv(pl_sd) -level)
level = pc_maxbaselv(pl_sd) - pl_sd->status.base_level;
for (i = 1; i <= level; i++)
pl_sd->status.status_point += (pl_sd->status.base_level + i + 14) / 5;
@ -1279,16 +1280,17 @@ int charcommand_baselevel(
clif_displaymessage(fd, msg_table[193]); // Character's base level can't go any lower.
return -1;
}
if (level < -(int)pc_maxbaselv(pl_sd) || level < (1 - (int)pl_sd->status.base_level)) // fix negativ overflow
level = 1 - pl_sd->status.base_level;
level *= -1;
if ((unsigned int)level >= pl_sd->status.base_level)
level = pl_sd->status.base_level -1;
if (pl_sd->status.status_point > 0) {
for (i = 0; i > level; i--)
pl_sd->status.status_point -= (pl_sd->status.base_level + i + 14) / 5;
for (i = 0; i > -level; i--)
pl_sd->status.status_point -= (pl_sd->status.base_level +i + 14) / 5;
if (pl_sd->status.status_point < 0)
pl_sd->status.status_point = 0;
clif_updatestatus(pl_sd, SP_STATUSPOINT);
} // to add: remove status points from stats
pl_sd->status.base_level += level;
pl_sd->status.base_level -= level;
clif_updatestatus(pl_sd, SP_BASELEVEL);
clif_updatestatus(pl_sd, SP_NEXTBASEEXP);
status_calc_pc(pl_sd, 0);
@ -1333,7 +1335,8 @@ int charcommand_joblevel(
clif_displaymessage(fd, msg_table[67]); // Character's job level can't go any higher.
return -1;
}
if ((int)pl_sd->status.job_level + level > pc_maxjoblv(pl_sd))
if ((unsigned int)level > pc_maxjoblv(pl_sd) ||
pl_sd->status.job_level > pc_maxjoblv(pl_sd) -level)
level = pc_maxjoblv(pl_sd) - pl_sd->status.job_level;
pl_sd->status.job_level += level;
clif_updatestatus(pl_sd, SP_JOBLEVEL);
@ -1348,13 +1351,14 @@ int charcommand_joblevel(
clif_displaymessage(fd, msg_table[194]); // Character's job level can't go any lower.
return -1;
}
if (pl_sd->status.job_level + level < 1)
level = 1 - pl_sd->status.job_level;
pl_sd->status.job_level += level;
level*=-1;
if ((unsigned int)level >= pl_sd->status.job_level)
level = pl_sd->status.job_level-1;
pl_sd->status.job_level -= level;
clif_updatestatus(pl_sd, SP_JOBLEVEL);
clif_updatestatus(pl_sd, SP_NEXTJOBEXP);
if (pl_sd->status.skill_point > 0) {
pl_sd->status.skill_point += level;
pl_sd->status.skill_point -= level;
if (pl_sd->status.skill_point < 0)
pl_sd->status.skill_point = 0;
clif_updatestatus(pl_sd, SP_SKILLPOINT);

View File

@ -845,15 +845,16 @@ struct mob_data {
int id;
int dmg;
} dmglog[DAMAGELOG_SIZE];
unsigned long tdmg; //Stores total damage given to the mob, for exp calculations. [Skotlex]
short n;
short base_class,class_,dir,mode,level;
short base_class,class_,dir,mode;
short m,x0,y0,xs,ys;
short to_x,to_y;
short target_dir;
short speed;
short attacked_count;
short target_lv;
unsigned long tdmg; //Stores total damage given to the mob, for exp calculations. [Skotlex]
unsigned int level;
int timer;
int hp, max_hp;
int target_id,attacked_id;

View File

@ -2208,7 +2208,6 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
int mvp_damage,max_hp;
unsigned int tick = gettick();
struct map_session_data *mvp_sd = NULL, *second_sd = NULL,*third_sd = NULL;
struct block_list *master = NULL;
double temp;
struct item item;
int ret, mode;
@ -2490,12 +2489,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
per /=2.;
else if(md->special_state.size==2)
per *=2.;
if(md->master_id) {
if(((master = map_id2bl(md->master_id)) && status_get_mode(master)&MD_BOSS) || // check if its master is a boss (MVP's and minibosses)
md->special_state.ai) { // for summoned creatures [Valaris]
per = 0;
}
} else {
if(md->master_id && md->special_state.ai) //New rule: Only player-summoned mobs do not give exp. [Skotlex]
per = 0;
else {
if(battle_config.zeny_from_mobs) {
if(md->level > 0) zeny=(int) ((md->level+rand()%md->level)*per); // zeny calculation moblv + random moblv [Valaris]
if(md->db->mexp > 0)
@ -2581,11 +2577,10 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
for (i = 0; i < 10; i++) { // 8 -> 10 Lupus
struct delay_item_drop *ditem;
if ((master && status_get_mode(master) & MD_BOSS) || // check if its master is a boss (MVP's and minibosses)
(md->special_state.ai &&
(battle_config.alchemist_summon_reward == 0 || //Noone gives items
(md->class_ != 1142 && battle_config.alchemist_summon_reward == 1) //Non Marine spheres don't drop items
))) // Added [Valaris]
if (md->master_id && md->special_state.ai && (
battle_config.alchemist_summon_reward == 0 || //Noone gives items
(md->class_ != 1142 && battle_config.alchemist_summon_reward == 1) //Non Marine spheres don't drop items
))
break; // End
//mapflag: noloot check [Lorky]
if (map[md->bl.m].flag.nomobloot) break;;

View File

@ -5778,13 +5778,13 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
switch(type){
case SP_BASELEVEL:
if (val > pc_maxbaselv(sd)) //Capping to max
if ((unsigned int)val > pc_maxbaselv(sd)) //Capping to max
val = pc_maxbaselv(sd);
if (val > sd->status.base_level) {
for (i = 1; i <= (val - (int)sd->status.base_level); i++)
if ((unsigned int)val > sd->status.base_level) {
for (i = 1; i <= ((unsigned int)val - sd->status.base_level); i++)
sd->status.status_point += (sd->status.base_level + i + 14) / 5 ;
}
sd->status.base_level = val;
sd->status.base_level = (unsigned int)val;
sd->status.base_exp = 0;
clif_updatestatus(sd, SP_BASELEVEL);
clif_updatestatus(sd, SP_NEXTBASEEXP);
@ -5794,13 +5794,13 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
pc_heal(sd, sd->status.max_hp, sd->status.max_sp);
break;
case SP_JOBLEVEL:
if (val >= (int)sd->status.job_level) {
if (val > pc_maxjoblv(sd)) val = pc_maxjoblv(sd);
sd->status.skill_point += (val-sd->status.job_level);
if ((unsigned int)val >= sd->status.job_level) {
if ((unsigned int)val > pc_maxjoblv(sd)) val = pc_maxjoblv(sd);
sd->status.skill_point += ((unsigned int)val-sd->status.job_level);
clif_updatestatus(sd, SP_SKILLPOINT);
clif_misceffect(&sd->bl, 1);
}
sd->status.job_level = val;
sd->status.job_level = (unsigned int)val;
sd->status.job_exp = 0;
clif_updatestatus(sd, SP_JOBLEVEL);
clif_updatestatus(sd, SP_NEXTJOBEXP);
@ -8055,7 +8055,7 @@ int pc_split_atoui(char *str,unsigned int *val, char sep, int max)
{
static int warning=0;
int i,j;
float f;
double f;
for (i=0; i<max; i++) {
if (!str) break;
f = atof(str);
@ -8110,7 +8110,8 @@ int pc_readdb(void)
}
while(fgets(line, sizeof(line)-1, fp)){
int jobs[MAX_PC_CLASS], job_count, job;
int type, max;
int type;
unsigned int max;
char *split[3];
if(line[0]=='/' && line[1]=='/')
continue;

View File

@ -2306,7 +2306,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data )
int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int x,int y,int skill_id,int skill_lv,int type,int flag)
{
int i, max;
unsigned short *count=NULL;;
unsigned short *count=NULL;
struct skill_timerskill *sts = NULL;
nullpo_retr(1, src);
switch (src->type) {
@ -5062,7 +5062,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case NPC_POWERUP:
// +20% attack per skill level? It's a guess... [Skotlex]
status_change_start(bl,SC_INCATKRATE,100,20*skilllv,0,0,0,skilllv * 60000,0);
status_change_start(bl,SC_INCATKRATE,100,40*skilllv,0,0,0,skilllv * 60000,0);
// another random guess xP
clif_skill_nodamage(src,bl,skillid,skilllv,
status_change_start(bl,SC_INCALLSTATUS,100,

View File

@ -3597,13 +3597,9 @@ int status_get_sc_def(struct block_list *bl, int type)
}
sc_def*=100; //Send it on the interval 0->10000
if(bl->type == BL_MOB) {
struct mob_data *md = (struct mob_data *)bl;
if (md->class_ == MOBID_EMPERIUM)
return 0;
if (sc_def > 5000)
sc_def = 5000;
}
if(bl->type == BL_MOB && sc_def > 5000)
sc_def = 5000; //Are mobs really capped to 50% defense?
sd = bl->type==BL_PC?(struct map_session_data*)bl:NULL;
if(sd && SC_COMMON_MIN<=type && type<=SC_COMMON_MAX &&
@ -3724,12 +3720,12 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
//Check rate
if (!(flag&(4|1))) {
rate*=100; //Pass to 10000 = 100%
if (flag&8) {
race = status_get_sc_def(bl, type);
if (race)
rate -= rate*race/100;
} else
rate*=100; //Pass to 10000 = 100%
rate -= rate*race/10000;
}
if (!(rand()%10000 < rate))
return 0;
}
@ -3742,8 +3738,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
//Check for inmunities / sc fails
switch (type) {
case SC_FREEZE:
if (elem == 1 && !(flag&1))
return 0; //Can't freeze water elementals.
case SC_STONE:
//Undead are inmune to Freeze/Stone
if (undead_flag && !(flag&1))