summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-14 13:46:14 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-14 13:46:14 +0000
commit4be12e4c23f2a73543fa60ff3e0e0f4235a49ff0 (patch)
tree6f8c93989fac5b609363d112e91213387607e478 /src/map
parentdca95417da6587e2bc8916cbc749b28430e82b84 (diff)
downloadhercules-4be12e4c23f2a73543fa60ff3e0e0f4235a49ff0.tar.gz
hercules-4be12e4c23f2a73543fa60ff3e0e0f4235a49ff0.tar.bz2
hercules-4be12e4c23f2a73543fa60ff3e0e0f4235a49ff0.tar.xz
hercules-4be12e4c23f2a73543fa60ff3e0e0f4235a49ff0.zip
- Corrected Smokie's pet script to use petskillbonus instead of "bonus"
- Added constant map_flag_gvg2 which tags gvg maps independently of whether woe is on or off. - battle_calc_gvg_damage will be invoked in gvg maps regardless of woe time. - NPC_MENTALBREAKER now zaps matk*lv SP based on observations by Tharis. - md->class_ will be changed on mob-class-change to fix all class-change related bugs. On respawn, the spawn data will be used to revert to the original class. - Improved the pet skillbonus timer for "eternal bonuses" cases where the bonus delay is 0. - Adjusted gvg long damage rate to 80%, magic damage rate to 60% git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8748 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c10
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/mob.c9
-rw-r--r--src/map/pet.c21
-rw-r--r--src/map/skill.c11
-rw-r--r--src/map/status.c2
-rw-r--r--src/map/unit.c3
7 files changed, 35 insertions, 24 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 6ee40df35..246d3fae4 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2011,18 +2011,18 @@ static struct Damage battle_calc_weapon_attack(
{ //There is a total damage value
if(!wd.damage2) {
wd.damage=battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
- if (map_flag_gvg(target->m))
+ if (map_flag_gvg2(target->m))
wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
} else
if(!wd.damage) {
wd.damage2=battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
- if (map_flag_gvg(target->m))
+ if (map_flag_gvg2(target->m))
wd.damage2=battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
} else
{
int d1=wd.damage+wd.damage2,d2=wd.damage2;
wd.damage=battle_calc_damage(src,target,d1,wd.div_,skill_num,skill_lv,wd.flag);
- if (map_flag_gvg(target->m))
+ if (map_flag_gvg2(target->m))
wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
wd.damage2=(d2*100/d1)*wd.damage/100;
if(wd.damage > 1 && wd.damage2 < 1) wd.damage2=1;
@@ -2454,7 +2454,7 @@ struct Damage battle_calc_magic_attack(
ad.damage = ad.damage>0?1:-1;
ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
- if (map_flag_gvg(target->m))
+ if (map_flag_gvg2(target->m))
ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
return ad;
}
@@ -2713,7 +2713,7 @@ struct Damage battle_calc_misc_attack(
md.damage=battle_attr_fix(src, target, md.damage, s_ele, tstatus->def_ele, tstatus->ele_lv);
md.damage=battle_calc_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag);
- if (map_flag_gvg(target->m))
+ if (map_flag_gvg2(target->m))
md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag);
return md;
diff --git a/src/map/map.h b/src/map/map.h
index b0b114f99..d855f2d53 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -168,7 +168,8 @@ enum {
#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle))
//Specifies maps that have special GvG/WoE restrictions
#define map_flag_gvg(m) (map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle))
-
+//Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status)
+#define map_flag_gvg2(m) (map[m].flag.gvg || map[m].flag.gvg_castle)
//Caps values to min/max
#define cap_value(a, min, max) (a>=max?max:a<=min?min:a)
diff --git a/src/map/mob.c b/src/map/mob.c
index ca12ba0eb..6742c204a 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -632,11 +632,13 @@ int mob_spawn (struct mob_data *md)
md->last_thinktime = tick -MIN_MOBTHINKTIME;
if (md->bl.prev != NULL)
unit_remove_map(&md->bl,2);
- else if (md->vd->class_ != md->class_) {
+ else
+ if (md->spawn && md->class_ != md->spawn->class_)
+ {
+ md->class_ = md->spawn->class_;
status_set_viewdata(&md->bl, md->class_);
md->db = mob_db(md->class_);
- if (md->spawn)
- memcpy(md->name,md->spawn->name,NAME_LENGTH);
+ memcpy(md->name,md->spawn->name,NAME_LENGTH);
}
if (md->spawn) { //Respawn data
@@ -2286,6 +2288,7 @@ int mob_class_change (struct mob_data *md, int class_)
return 0; //Clones
hp_rate = md->status.hp*100/md->status.max_hp;
+ md->class_ = class_;
md->db = mob_db(class_);
if (battle_config.override_mob_names==1)
memcpy(md->name,md->db->name,NAME_LENGTH-1);
diff --git a/src/map/pet.c b/src/map/pet.c
index 9b5f6a3a3..d4069513f 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -577,12 +577,12 @@ int pet_catch_process2(struct map_session_data *sd,int target_id)
pc_delitem(sd,i,1,0);
}
- i = search_petDB_index(md->vd->class_,PET_CLASS);
+ i = search_petDB_index(md->class_,PET_CLASS);
//catch_target_class == 0 is used for universal lures. [Skotlex]
//for now universal lures do not include bosses.
if (sd->catch_target_class == 0 && !(md->status.mode&MD_BOSS))
- sd->catch_target_class = md->vd->class_;
- if(i < 0 || sd->catch_target_class != md->vd->class_) {
+ sd->catch_target_class = md->class_;
+ if(i < 0 || sd->catch_target_class != md->class_) {
clif_emotion(&md->bl, 7); //mob will do /ag if wrong lure is used on them.
clif_pet_rulet(sd,0);
sd->catch_target_class = -1;
@@ -1100,6 +1100,7 @@ int pet_skill_bonus_timer(int tid,unsigned int tick,int id,int data)
{
struct map_session_data *sd=map_id2sd(id);
struct pet_data *pd;
+ int bonus;
int timer = 0;
if(sd == NULL || sd->pd==NULL || sd->pd->bonus == NULL)
@@ -1117,23 +1118,23 @@ int pet_skill_bonus_timer(int tid,unsigned int tick,int id,int data)
}
// determine the time for the next timer
- if (pd->state.skillbonus) {
- pd->state.skillbonus = 0;
+ if (pd->state.skillbonus && pd->bonus->delay > 0) {
+ bonus = 0;
timer = pd->bonus->delay*1000; // the duration until pet bonuses will be reactivated again
- if (timer <= 0) //Always active bonus
- timer = MIN_PETTHINKTIME;
} else if (pd->pet.intimate) {
- pd->state.skillbonus = 1;
+ bonus = 1;
timer = pd->bonus->duration*1000; // the duration for pet bonuses to be in effect
} else { //Lost pet...
pd->bonus->timer = -1;
return 0;
}
- status_calc_pc(sd, 0);
+ if (pd->state.skillbonus != bonus) {
+ pd->state.skillbonus = bonus;
+ status_calc_pc(sd, 0);
+ }
// wait for the next timer
pd->bonus->timer=add_timer(tick+timer,pet_skill_bonus_timer,sd->bl.id,0);
-
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 83954c9a2..5842cdc31 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1234,9 +1234,16 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
sc_start(bl,SkillStatusChangeTable(skillid),50+10*skilllv,skilllv,src->type==BL_PET?skilllv*1000:skill_get_time2(skillid,skilllv));
break;
- case NPC_MENTALBREAKER:
- status_percent_damage(src, bl, 0, -(10+skilllv));
+ case NPC_MENTALBREAKER:
+ { //Based on observations by Tharis, Mental Breaker should do SP damage
+ //equal to Matk*skLevel.
+ rate = sstatus->matk_min;
+ if (rate < sstatus->matk_max)
+ rate += rand()%(sstatus->matk_max - sstatus->matk_min);
+ rate*=skilllv;
+ status_zap(bl, 0, rate);
break;
+ }
// Equipment breaking monster skills [Celest]
case NPC_BREAKWEAPON:
skill_break_equip(bl, EQP_WEAPON, 150*skilllv, BCT_ENEMY);
diff --git a/src/map/status.c b/src/map/status.c
index fb39d8e2b..ccff0a457 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6143,7 +6143,7 @@ int status_change_end( struct block_list* bl , int type,int tid )
case SC_CHANGE:
if (tid == -1)
break;
- // "lose almost all her HP and SP" on natural expiration.
+ // "lose almost all their HP and SP" on natural expiration.
status_set_hp(bl, 10, 0);
status_set_sp(bl, 10, 0);
break;
diff --git a/src/map/unit.c b/src/map/unit.c
index 396eeca45..2bc274d10 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -169,8 +169,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data)
sd->areanpc_id=0;
if (sd->state.gmaster_flag &&
(battle_config.guild_aura&(agit_flag?2:1)) &&
- (battle_config.guild_aura&
- (map[bl->m].flag.gvg || map[bl->m].flag.gvg_castle?8:4))
+ (battle_config.guild_aura&(map_flag_gvg2(bl->m)?8:4))
)
{ //Guild Aura: Likely needs to be recoded, this method seems inefficient.
struct guild *g = sd->state.gmaster_flag;