Partial(?) fix to damage reduction from cards - Concerning bugreport:7809

Moved pc_dead NPC event calls to the end of the death process - Fixes bugreport:7829
Super Novices are no longer counted as dead when saved by their angel - Fixes bugreport:4053 and bugreport:1601
- They won't lose their +10 bonus on the first death
- Pet intimacy, mercenaries, skull drops are unaffected by first death
- Steel Body is level 5 when saved

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17420 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
akinari1087 2013-07-13 22:06:03 +00:00
parent 216fe46dbe
commit 43688de318
3 changed files with 34 additions and 35 deletions

View File

@ -4396,14 +4396,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
#endif
}
#ifdef RENEWAL
if(!sd) {
#endif
if(tsd) // Card Fix for target (tsd), 2 is not added to the "left" flag meaning "target cards only"
wd.damage += battle_calc_cardfix(BF_WEAPON, src, target, battle_skill_get_damage_properties(skill_id, wd.miscflag), right_element, left_element, wd.damage, is_attack_left_handed(src, skill_id), wd.flag);
#ifdef RENEWAL
}
#endif
if(tsd) // Card Fix for target (tsd), 2 is not added to the "left" flag meaning "target cards only"
wd.damage += battle_calc_cardfix(BF_WEAPON, src, target, battle_skill_get_damage_properties(skill_id, wd.miscflag), right_element, left_element, wd.damage, is_attack_left_handed(src, skill_id), wd.flag);
// forced to neutral skills [helvetica]
// skills forced to neutral gain benefits from weapon element

View File

@ -6666,6 +6666,25 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
int i=0,j=0,k=0;
unsigned int tick = gettick();
// Activate Steel body if a super novice dies at 99+% exp [celest]
// Super Novices have no kill or die functions attached when saved by their angel
if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) {
unsigned int next = pc_nextbaseexp(sd);
if( next == 0 ) next = pc_thisbaseexp(sd);
if( get_percentage(sd->status.base_exp,next) >= 99 ) {
sd->state.snovice_dead_flag = 1;
pc_setrestartvalue(sd,1);
status_percent_heal(&sd->bl, 100, 100);
clif_resurrection(&sd->bl, 1);
if(battle_config.pc_invincible_time)
pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
sc_start(&sd->bl,&sd->bl,status_skill2sc(MO_STEELBODY),100,5,skill_get_time(MO_STEELBODY,5));
if(map_flag_gvg(sd->bl.m))
pc_respawn_timer(INVALID_TIMER, gettick(), sd->bl.id, 0);
return 0;
}
}
for(k = 0; k < 5; k++)
if (sd->devotion[k]){
struct map_session_data *devsd = map_id2sd(sd->devotion[k]);
@ -6721,14 +6740,6 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
pc_setglobalreg(sd,"PC_DIE_COUNTER",sd->die_counter+1);
pc_setparam(sd, SP_KILLERRID, src?src->id:0);
if( sd->bg_id ) {
struct battleground_data *bg;
if( (bg = bg_team_search(sd->bg_id)) != NULL && bg->die_event[0] )
npc_event(sd, bg->die_event, 0);
}
npc_script_event(sd,NPCE_DIE);
//Reset menu skills/item skills
if (sd->skillitem)
sd->skillitem = sd->skillitemlv = 0;
@ -6823,25 +6834,6 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
// activate Steel body if a super novice dies at 99+% exp [celest]
if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) {
unsigned int next = pc_nextbaseexp(sd);
if( next == 0 ) next = pc_thisbaseexp(sd);
if( get_percentage(sd->status.base_exp,next) >= 99 ) {
sd->state.snovice_dead_flag = 1;
pc_setstand(sd);
pc_setrestartvalue(sd,1);
status_percent_heal(&sd->bl, 100, 100);
clif_resurrection(&sd->bl, 1);
if(battle_config.pc_invincible_time)
pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
sc_start(&sd->bl,&sd->bl,status_skill2sc(MO_STEELBODY),100,1,skill_get_time(MO_STEELBODY,1));
if(map_flag_gvg(sd->bl.m))
pc_respawn_timer(INVALID_TIMER, gettick(), sd->bl.id, 0);
return 0;
}
}
// changed penalty options, added death by player if pk_mode [Valaris]
if(battle_config.death_penalty_type
&& (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty

View File

@ -22,6 +22,7 @@
#include "skill.h"
#include "itemdb.h"
#include "battle.h"
#include "battleground.h"
#include "chrif.h"
#include "skill.h"
#include "status.h"
@ -1338,6 +1339,18 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
skill_cleartimerskill(target);
}
// Always run NPC scripts for players last
if(target->type == BL_PC) {
TBL_PC *sd = BL_CAST(BL_PC,target);
if( sd->bg_id ) {
struct battleground_data *bg;
if( (bg = bg_team_search(sd->bg_id)) != NULL && bg->die_event[0] )
npc_event(sd, bg->die_event, 0);
}
npc_script_event(sd,NPCE_DIE);
}
return hp+sp;
}