summaryrefslogtreecommitdiff
path: root/src/map/battle.c
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/map/battle.c
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/map/battle.c')
-rw-r--r--src/map/battle.c102
1 files changed, 38 insertions, 64 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){