From 71f8d31bc902a66649bf467264196444be93950e Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 7 Aug 2006 14:38:23 +0000 Subject: - Adjusted Battle_check_target so that alchemist summoned mobs are targetted by everyone as long as 1. The top-level master is a player and 2. the actual attacker is not a mob-type. - Added config force_random_spawn which overrides the spawn-files defined coordinates to make all mobs always spawn randomly on the map. - SC_SPEEDUP0 is no longer dispellable by SA_DISPEL git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8159 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 9 ++++++--- src/map/battle.h | 1 + src/map/npc.c | 5 +++++ src/map/skill.c | 32 +++++++++++++++++++++----------- 4 files changed, 33 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index 736ec637d..a1f0e2a90 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1763,7 +1763,6 @@ static struct Damage battle_calc_weapon_attack( wd.damage = battle_addmastery(sd,target,wd.damage,0); if (flag.lh) wd.damage2 = battle_addmastery(sd,target,wd.damage2,1); - if((skill=pc_checkskill(sd,SG_STAR_ANGER)) >0 && (t_class == sd->hate_mob[2] || (sc && sc->data[SC_MIRACLE].timer!=-1))) { skillratio = (sd->status.base_level + sstatus->str + sstatus->dex + sstatus->luk)/(skill<4?12-3*skill:1); @@ -3173,8 +3172,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return -1; //Cannot be targeted yet. break; case BL_MOB: - if (((TBL_MOB*)target)->special_state.ai > 1) - { //Alchemist summoned mobs are sort of universal enemies. + if (((TBL_MOB*)target)->special_state.ai > 1 && + s_bl->type == BL_PC && src->type != BL_MOB) + { //Alchemist summoned mobs are always targettable by players state |= BCT_ENEMY; strip_enemy = 0; } @@ -3509,6 +3509,8 @@ static const struct battle_data_short { { "mob_count_rate", &battle_config.mob_count_rate }, { "mob_spawn_delay", &battle_config.mob_spawn_delay }, { "no_spawn_on_player", &battle_config.no_spawn_on_player }, + + { "force_random_spawn", &battle_config.force_random_spawn }, { "plant_spawn_delay", &battle_config.plant_spawn_delay }, { "boss_spawn_delay", &battle_config.boss_spawn_delay }, { "slaves_inherit_mode", &battle_config.slaves_inherit_mode }, @@ -3914,6 +3916,7 @@ void battle_set_defaults() { battle_config.mob_count_rate=100; battle_config.mob_spawn_delay=100; battle_config.no_spawn_on_player=0; + battle_config.force_random_spawn=0; battle_config.plant_spawn_delay=100; battle_config.boss_spawn_delay=100; battle_config.slaves_inherit_mode=1; diff --git a/src/map/battle.h b/src/map/battle.h index 8dbad1ac0..43f20c4e0 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -157,6 +157,7 @@ extern struct Battle_Config { unsigned short mob_skill_delay; //[Skotlex] unsigned short mob_count_rate; unsigned short no_spawn_on_player; //[Skotlex] + unsigned short force_random_spawn; //[Skotlex] unsigned short mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex] unsigned short slaves_inherit_mode; unsigned short slaves_inherit_speed; diff --git a/src/map/npc.c b/src/map/npc.c index ef8dbf8be..0ebec7aaf 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2217,6 +2217,11 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4) mob.num = 1; } + if (battle_config.force_random_spawn) + { //Force a random spawn anywhere on the map. + mob.x = mob.y = mob.xs = mob.ys = 0; + } + //Apply the spawn delay fix [Skotlex] mode = mob_db(class_)->status.mode; if (mode & MD_BOSS) { //Bosses diff --git a/src/map/skill.c b/src/map/skill.c index 6e9d5c9ff..2cd3ff4e6 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4438,14 +4438,24 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int strip_fix, equip = 0; int sclist[4] = {0,0,0,0}; - if (skillid == RG_STRIPWEAPON || skillid == ST_FULLSTRIP || skillid == GS_DISARM) - equip |= EQP_WEAPON; - if (skillid == RG_STRIPSHIELD || skillid == ST_FULLSTRIP) - equip |= EQP_SHIELD; - if (skillid == RG_STRIPARMOR || skillid == ST_FULLSTRIP) - equip |= EQP_ARMOR; - if (skillid == RG_STRIPHELM || skillid == ST_FULLSTRIP) - equip |= EQP_HELM; + switch (skillid) { + case RG_STRIPWEAPON: + case GS_DISARM: + equip = EQP_WEAPON; + break; + case RG_STRIPSHIELD: + equip = EQP_SHIELD; + break; + case RG_STRIPARMOR: + equip = EQP_ARMOR; + break; + case RG_STRIPHELM: + equip = EQP_HELM; + break; + case ST_FULLSTRIP: + equip = EQP_WEAPON|EQP_SHIELD|EQP_ARMOR|EQP_HELM; + break; + } strip_fix = sstatus->dex - tstatus->dex; if(strip_fix < 0) @@ -4462,7 +4472,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in continue; switch (i) { case EQI_HAND_L: //Shield / left-hand weapon - if(dstsd->inventory_data[dstsd->equip_index[EQI_HAND_L]]->type == IT_ARMOR) + if(dstsd->inventory_data[dstsd->equip_index[i]]->type == IT_ARMOR) { //Shield if (equip&EQP_SHIELD && !(dstsd->unstripable_equip&EQP_SHIELD) && @@ -4475,7 +4485,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } //Continue to weapon case EQI_HAND_R: - if (equip &EQP_WEAPON && + if (equip&EQP_WEAPON && !(dstsd->unstripable_equip&EQP_WEAPON) && !(tsc && tsc->data[SC_CP_WEAPON].timer != -1) ) { @@ -4663,7 +4673,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in || i==SC_CP_WEAPON || i==SC_CP_SHIELD || i==SC_CP_ARMOR || i==SC_CP_HELM || i==SC_COMBO || i==SC_DANCING || i==SC_GUILDAURA || i==SC_EDP || i==SC_AUTOBERSERK || i==SC_CARTBOOST || i==SC_MELTDOWN || i==SC_MOONLIT - || i==SC_SAFETYWALL || i==SC_SMA + || i==SC_SAFETYWALL || i==SC_SMA || i==SC_SPEEDUP0 ) continue; if(i==SC_BERSERK) tsc->data[i].val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. -- cgit v1.2.3-70-g09d2