summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-05 23:10:47 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-05 23:10:47 +0000
commit5eb3f45f49a8437e82fa27a52c70c0a611acaeb3 (patch)
tree8a92fc9ac462787ea804d064477318eb6e3cdb80 /src
parentcf7fd037745119d150db5e91fb3978b00f2b8851 (diff)
downloadhercules-5eb3f45f49a8437e82fa27a52c70c0a611acaeb3.tar.gz
hercules-5eb3f45f49a8437e82fa27a52c70c0a611acaeb3.tar.bz2
hercules-5eb3f45f49a8437e82fa27a52c70c0a611acaeb3.tar.xz
hercules-5eb3f45f49a8437e82fa27a52c70c0a611acaeb3.zip
- Updated the code so that now a range of a skill is determined by the skill's range in the db. Now only skills with less than 5 cells of range are melee.
- The inf2 parameter of the skill_db is now red as an hexadecimal. - Updated comments and inf2 values of the skill_db to use the new format. - Soul Change now can't be casted on self. - Updated range of Grandcross, Granddarkness and Gospel to 5 so when they attack their attack type is counted as ranged. - Splitted the super novice flag in two, to keep seperate counters for the chant and for the self-revival. The self-revive will now trigger only once per level per session, if you relog you can have it trigger again. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9794 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c102
-rw-r--r--src/map/clif.c10
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/pc.c17
-rw-r--r--src/map/skill.c2
5 files changed, 56 insertions, 78 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index bf79ff9b5..4aec803f7 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -899,14 +899,13 @@ static struct Damage battle_calc_weapon_attack(
wd.blewcount += sd->skillblown[i].val;
}
}
+
//Set miscellaneous data that needs be filled regardless of hit/miss
if(
(sd && sd->state.arrow_atk) ||
(!sd && ((skill_num && skill_get_ammotype(skill_num)) || sstatus->rhw.range>3))
- ) {
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
+ )
flag.arrow = 1;
- }
if(skill_num){
wd.flag=(wd.flag&~BF_SKILLMASK)|BF_SKILL;
@@ -919,36 +918,15 @@ static struct Damage battle_calc_weapon_attack(
else
wd.div_ = sd->spiritball_old;
}
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
break;
case HT_PHANTASMIC:
//Since these do not consume ammo, they need to be explicitly set as arrow attacks.
flag.arrow = 1;
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
- break;
- case GS_DESPERADO:
- case GS_DUST:
- //This one is the opposite, it consumes ammo, but should count as short range.
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_SHORT;
break;
+
case CR_SHIELDBOOMERANG:
case PA_SHIELDCHAIN:
flag.weapon = 0;
- case AS_GRIMTOOTH:
- case KN_SPEARBOOMERANG:
- case NPC_RANGEATTACK:
- case LK_SPIRALPIERCE:
- case ASC_BREAKER:
- case AM_ACIDTERROR:
- case ITM_TOMAHAWK: //Tomahawk is a ranged attack! [Skotlex]
- case CR_GRANDCROSS:
- case NPC_GRANDDARKNESS:
- case NJ_HUUMA:
- case NJ_ISSEN:
- case GS_TRIPLEACTION:
- case GS_BULLSEYE:
- case GS_MAGICALBULLET:
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
break;
case KN_PIERCE:
@@ -961,7 +939,6 @@ static struct Damage battle_calc_weapon_attack(
break;
case GS_GROUNDDRIFT:
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
case KN_SPEARSTAB:
case KN_BOWLINGBASH:
case MO_BALKYOUNG:
@@ -969,12 +946,6 @@ static struct Damage battle_calc_weapon_attack(
wd.blewcount=0;
break;
- case CR_SHIELDCHARGE:
-// flag.weapon = 0;
- case NPC_PIERCINGATT:
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_SHORT;
- break;
-
case KN_AUTOCOUNTER:
wd.flag=(wd.flag&~BF_SKILLMASK)|BF_NORMAL;
break;
@@ -983,26 +954,24 @@ static struct Damage battle_calc_weapon_attack(
flag.cri = 1; //Always critical skill.
break;
}
- }
- if (skill_num && battle_config.skillrange_by_distance &&
- (src->type&battle_config.skillrange_by_distance)
- ) { //Skill range based on distance between src/target [Skotlex]
- if (check_distance_bl(src, target, 3))
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_SHORT;
- else
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
- }
+ //Skill Range Criteria
+ if (battle_config.skillrange_by_distance &&
+ (src->type&battle_config.skillrange_by_distance)
+ ) { //based on distance between src/target [Skotlex]
+ if (check_distance_bl(src, target, 3))
+ wd.flag=(wd.flag&~BF_RANGEMASK)|BF_SHORT;
+ else
+ wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
+ } else { //based on used skill's range
+ if (skill_get_range(skill_num, skill_lv) < 5)
+ wd.flag=(wd.flag&~BF_RANGEMASK)|BF_SHORT;
+ else
+ wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
+ }
+ } else if (flag.arrow) //Make the normal attack ranged.
+ wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
-/* Apparently counter attack no longer causes you to be critical'ed by mobs. [Skotlex]
- //Check for counter
- if(!skill_num)
- {
- if(tsc && tsc->data[SC_AUTOCOUNTER].timer != -1)
- //If it got here and you had autocounter active, then the direction/range does not matches: critical
- flag.cri = 1;
- } //End counter-check
-*/
if (!skill_num && tstatus->flee2 && rand()%1000 < tstatus->flee2)
{ //Check for Lucky Dodge
wd.type=0x0b;
@@ -2206,7 +2175,7 @@ struct Damage battle_calc_magic_attack(
ad.amotion=skill_get_inf(skill_num)&INF_GROUND_SKILL?0:sstatus->amotion; //Amotion should be 0 for ground skills.
ad.dmotion=tstatus->dmotion;
ad.blewcount = skill_get_blewcount(skill_num,skill_lv);
- ad.flag=BF_MAGIC|BF_LONG|BF_SKILL;
+ ad.flag=BF_MAGIC|BF_SKILL;
ad.dmg_lv=ATK_DEF;
BL_CAST(BL_PC, src, sd);
@@ -2231,13 +2200,19 @@ struct Damage battle_calc_magic_attack(
}
}
+ //Skill Range Criteria
if (battle_config.skillrange_by_distance &&
(src->type&battle_config.skillrange_by_distance)
- ) { //Skill range based on distance between src/target [Skotlex]
+ ) { //based on distance between src/target [Skotlex]
if (check_distance_bl(src, target, 3))
ad.flag=(ad.flag&~BF_RANGEMASK)|BF_SHORT;
else
ad.flag=(ad.flag&~BF_RANGEMASK)|BF_LONG;
+ } else { //based on used skill's range
+ if (skill_get_range(skill_num, skill_lv) < 5)
+ ad.flag=(ad.flag&~BF_RANGEMASK)|BF_SHORT;
+ else
+ ad.flag=(ad.flag&~BF_RANGEMASK)|BF_LONG;
}
flag.infdef=(tstatus->mode&MD_PLANT?1:0);
@@ -2563,7 +2538,7 @@ struct Damage battle_calc_misc_attack(
md.div_=skill_get_num( skill_num,skill_lv );
md.blewcount=skill_get_blewcount(skill_num,skill_lv);
md.dmg_lv=ATK_DEF;
- md.flag=BF_MISC|BF_SHORT|BF_SKILL;
+ md.flag=BF_MISC|BF_SKILL;
flag.cardfix = flag.elefix = flag.hit = 1;
@@ -2586,19 +2561,12 @@ struct Damage battle_calc_misc_attack(
//Misc Settings
switch(skill_num){
- case PA_PRESSURE:
- case GS_FLING:
- case NJ_ZENYNAGE:
- flag.cardfix = 0;
case ASC_BREAKER:
flag.elefix = 0;
- case HT_BLITZBEAT:
- case TF_THROWSTONE:
- case SN_FALCONASSAULT:
- case PA_GOSPEL:
- case CR_ACIDDEMONSTRATION:
- md.flag = (md.flag&~BF_RANGEMASK)|BF_LONG;
break;
+ case PA_PRESSURE:
+ case GS_FLING:
+ case NJ_ZENYNAGE:
case HVAN_EXPLOSION:
case NPC_SELFDESTRUCTION:
case NPC_SMOKING:
@@ -2609,13 +2577,19 @@ struct Damage battle_calc_misc_attack(
break;
}
+ //Skill Range Criteria
if (battle_config.skillrange_by_distance &&
(src->type&battle_config.skillrange_by_distance)
- ) { //Skill range based on distance between src/target [Skotlex]
+ ) { //based on distance between src/target [Skotlex]
if (check_distance_bl(src, target, 3))
md.flag=(md.flag&~BF_RANGEMASK)|BF_SHORT;
else
md.flag=(md.flag&~BF_RANGEMASK)|BF_LONG;
+ } else { //based on used skill's range
+ if (skill_get_range(skill_num, skill_lv) < 5)
+ md.flag=(md.flag&~BF_RANGEMASK)|BF_SHORT;
+ else
+ md.flag=(md.flag&~BF_RANGEMASK)|BF_LONG;
}
switch(skill_num){
diff --git a/src/map/clif.c b/src/map/clif.c
index 8f4e625f1..9ba4f3959 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8614,19 +8614,19 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) // S 008c/00f
char buf[256];
int next = pc_nextbaseexp(sd);
if (next > 0 && (sd->status.base_exp * 1000 / next)% 100 == 0) {
- switch (sd->state.snovice_flag) {
+ switch (sd->state.snovice_call_flag) {
case 0:
if (strstr(message, msg_txt(504)))
- sd->state.snovice_flag++;
+ sd->state.snovice_call_flag++;
break;
case 1:
sprintf(buf, msg_txt(505), sd->status.name);
if (strstr(message, buf))
- sd->state.snovice_flag++;
+ sd->state.snovice_call_flag++;
break;
case 2:
if (strstr(message, msg_txt(506)))
- sd->state.snovice_flag++;
+ sd->state.snovice_call_flag++;
break;
case 3:
if (skillnotok(MO_EXPLOSIONSPIRITS,sd))
@@ -8634,7 +8634,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) // S 008c/00f
clif_skill_nodamage(&sd->bl,&sd->bl,MO_EXPLOSIONSPIRITS,-1,
sc_start(&sd->bl,SkillStatusChangeTable(MO_EXPLOSIONSPIRITS),100,
17,skill_get_time(MO_EXPLOSIONSPIRITS,1))); //Lv17-> +50 critical (noted by Poki) [Skotlex]
- sd->state.snovice_flag = 0;
+ sd->state.snovice_call_flag= 0;
break;
}
}
diff --git a/src/map/map.h b/src/map/map.h
index 5f0365630..a547af985 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -567,7 +567,8 @@ struct map_session_data {
unsigned gangsterparadise : 1;
unsigned rest : 1;
unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex]
- unsigned snovice_flag : 4;
+ unsigned snovice_call_flag : 2; //Summon Angel (stage 1~3)
+ unsigned snovice_dead_flag : 2; //Explosion spirits on death: 0 off, 1 active, 2 used.
// originally by Qamera, adapted by celest
unsigned event_death : 1;
unsigned event_kill_pc : 1;
diff --git a/src/map/pc.c b/src/map/pc.c
index b268ed629..82f85c1ca 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -282,9 +282,9 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
if (type&1)
{ //Normal resurrection
status->hp = 1; //Otherwise status_heal may fail if dead.
- if(sd->state.snovice_flag == 4) { // [Celest]
+ if(sd->state.snovice_dead_flag == 1) { // [Celest]
status_heal(&sd->bl, status->max_hp, status->max_sp, 1);
- sd->state.snovice_flag = 0;
+ sd->state.snovice_dead_flag = 2;
sc_start(&sd->bl,SkillStatusChangeTable(MO_STEELBODY),100,1,skill_get_time(MO_STEELBODY,1));
} else
status_heal(&sd->bl, b_status->hp, b_status->sp>status->sp?b_status->sp-status->sp:0, 1);
@@ -4090,6 +4090,8 @@ int pc_checkbaselevelup(struct map_session_data *sd)
sc_start(&sd->bl,SkillStatusChangeTable(PR_MAGNIFICAT),100,1,skill_get_time(PR_MAGNIFICAT,1));
sc_start(&sd->bl,SkillStatusChangeTable(PR_GLORIA),100,1,skill_get_time(PR_GLORIA,1));
sc_start(&sd->bl,SkillStatusChangeTable(PR_SUFFRAGIUM),100,1,skill_get_time(PR_SUFFRAGIUM,1));
+ if (sd->state.snovice_dead_flag == 2)
+ sd->state.snovice_dead_flag = 0; //Reenable steelbody resurrection on dead.
} else
if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON || (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR)
{
@@ -5021,15 +5023,16 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
}
// activate Steel body if a super novice dies at 99+% exp [celest]
- if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) {
+ if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag)
+ {
if ((i=pc_nextbaseexp(sd))<=0)
i=sd->status.base_exp;
if (i>0 && (j=sd->status.base_exp*1000/i)>=990 && j<1000 && !map_flag_gvg(sd->bl.m))
- sd->state.snovice_flag = 4;
+ sd->state.snovice_dead_flag = 1;
}
// changed penalty options, added death by player if pk_mode [Valaris]
- if(battle_config.death_penalty_type && sd->state.snovice_flag != 4
+ if(battle_config.death_penalty_type && sd->state.snovice_dead_flag != 1
&& (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty
&& !map[sd->bl.m].flag.noexppenalty && !map_flag_gvg(sd->bl.m)
&& sd->sc.data[SC_BABY].timer == -1)
@@ -5172,14 +5175,14 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
sc_start(&sd->bl,SkillStatusChangeTable(PR_KYRIE),100,10,skill_get_time2(SL_KAIZEL,j));
return 0;
}
- if (sd->state.snovice_flag == 4)
+ if (sd->state.snovice_dead_flag == 1)
{
pc_setstand(sd);
status_change_clear(&sd->bl,0);
clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,1,1);
status_percent_heal(&sd->bl, 100, 100);
clif_resurrection(&sd->bl, 1);
- sd->state.snovice_flag = 0;
+ sd->state.snovice_dead_flag = 2;
if(battle_config.pc_invincible_time)
pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
sc_start(&sd->bl,SkillStatusChangeTable(MO_STEELBODY),100,1,skill_get_time(MO_STEELBODY,1));
diff --git a/src/map/skill.c b/src/map/skill.c
index 8844485fb..9dd1a6c6c 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -11206,7 +11206,7 @@ int skill_readdb (void)
else
skill_db[i].castcancel=0;
skill_db[i].cast_def_rate=atoi(split[10]);
- skill_db[i].inf2=atoi(split[11]);
+ skill_db[i].inf2=(int)strtol(split[11], NULL, 0);
skill_db[i].maxcount=atoi(split[12]);
if(strcmpi(split[13],"weapon") == 0)
skill_db[i].skill_type=BF_WEAPON;