summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-08 19:33:01 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-08 19:33:01 +0000
commit1f8acdc9e58cd5344427babe69539ba86fdda03d (patch)
tree5a7f497e867ddf19a75f3aa241145d1418cb0e58 /src/map/pc.c
parenta9c2d623a66f27674ea539963a8738138ca7f6aa (diff)
downloadhercules-1f8acdc9e58cd5344427babe69539ba86fdda03d.tar.gz
hercules-1f8acdc9e58cd5344427babe69539ba86fdda03d.tar.bz2
hercules-1f8acdc9e58cd5344427babe69539ba86fdda03d.tar.xz
hercules-1f8acdc9e58cd5344427babe69539ba86fdda03d.zip
- Added battle config options:
- skill_caster_check (does a status_checkskilluse on all skill attacks) - status_cast_cancel (invokes skill_castcancel for opt1 type status changes) - Fixed the death exp penalty underflow bug git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5229 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c64
1 files changed, 39 insertions, 25 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index e3c843055..09ed0d7f7 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5489,33 +5489,47 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
&& !map[sd->bl.m].flag.nopenalty && !map_flag_gvg(sd->bl.m)
&& !(sd->sc.count && sd->sc.data[SC_BABY].timer!=-1))
{
- if(battle_config.death_penalty_type==1 && battle_config.death_penalty_base > 0)
- sd->status.base_exp -= (int) ((double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
- if(battle_config.pk_mode && src && src->type==BL_PC)
- sd->status.base_exp -= (int) ((double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
- else if(battle_config.death_penalty_type==2 && battle_config.death_penalty_base > 0) {
- if(pc_nextbaseexp(sd) > 0)
- sd->status.base_exp -= (int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000);
- if(battle_config.pk_mode && src && src->type==BL_PC)
- sd->status.base_exp -= (int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000);
+ unsigned int base_penalty =0;
+ if (battle_config.death_penalty_base > 0) {
+ switch (battle_config.death_penalty_type) {
+ case 1:
+ base_penalty += (unsigned int) ((double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
+ break;
+ case 2:
+ base_penalty = (unsigned int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000);
+ break;
}
- if(sd->status.base_exp < 0)
- sd->status.base_exp = 0;
- clif_updatestatus(sd,SP_BASEEXP);
-
- if(battle_config.death_penalty_type==1 && battle_config.death_penalty_job > 0)
- sd->status.job_exp -= (int) ((double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
- if(battle_config.pk_mode && src && src->type==BL_PC)
- sd->status.job_exp -= (int) ((double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
- else if(battle_config.death_penalty_type==2 && battle_config.death_penalty_job > 0) {
- if(pc_nextjobexp(sd) > 0)
- sd->status.job_exp -= (int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000);
- if(battle_config.pk_mode && src && src->type==BL_PC)
- sd->status.job_exp -= (int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000);
+ if(base_penalty) {
+ if (battle_config.pk_mode && src && src->type==BL_PC)
+ base_penalty*=2;
+ if(sd->status.base_exp < base_penalty)
+ sd->status.base_exp = 0;
+ else
+ sd->status.base_exp -= base_penalty;
+ clif_updatestatus(sd,SP_BASEEXP);
}
- if(sd->status.job_exp < 0)
- sd->status.job_exp = 0;
- clif_updatestatus(sd,SP_JOBEXP);
+ }
+ if(battle_config.death_penalty_job > 0)
+ {
+ base_penalty = 0;
+ switch (battle_config.death_penalty_type) {
+ case 1:
+ base_penalty = (unsigned int) ((double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
+ break;
+ case 2:
+ base_penalty = (unsigned int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000);
+ break;
+ }
+ if(base_penalty) {
+ if (battle_config.pk_mode && src && src->type==BL_PC)
+ base_penalty*=2;
+ if(sd->status.job_exp < base_penalty)
+ sd->status.job_exp = 0;
+ else
+ sd->status.job_exp -= base_penalty;
+ clif_updatestatus(sd,SP_JOBEXP);
+ }
+ }
}
if(src && src->type==BL_MOB) {
struct mob_data *md=(struct mob_data *)src;