From 05f88e6753ee38eb54be04bece08ad7b1a8382fd Mon Sep 17 00:00:00 2001 From: Komurka Date: Sat, 18 Feb 2006 13:16:21 +0000 Subject: * Implemented SG_MIRACLE (Miracle of the Sun, Moon and Stars) - duration is stored in battle_config.sg_miracle_skill_duration (currently it's set to 10 minutes) - ratio is stored in battle_config.sg_miracle_skill_ratio (currently it's set to 0.01% chance per character move) - this skill enables you usage of all Warmth skills, Comfort skills, and also all mobs will be target of the Stars regardless of the day and map - you'll see message "[Miracle of the Sun, Moon and Stars]" when skill kicks in git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5323 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 15 ++++++++++++++- src/map/battle.h | 3 +++ src/map/mob.c | 4 +++- src/map/pc.c | 7 +++++++ src/map/skill.c | 13 +++++++------ src/map/status.c | 2 ++ src/map/status.h | 1 + 7 files changed, 37 insertions(+), 8 deletions(-) (limited to 'src/map') diff --git a/src/map/battle.c b/src/map/battle.c index f7965a5b7..7439760b5 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1995,7 +1995,12 @@ static struct Damage battle_calc_weapon_attack( { //SG Anger bonus - ATK_ADDRATE [Komurka] static int type[] = { SG_SUN_ANGER, SG_MOON_ANGER, SG_STAR_ANGER }; short t_class = status_get_class(target); - for (i = 0; i < 3; i++) + if (sc->data && sc->data[SC_MIRACLE].timer!=-1 && (skill = pc_checkskill(sd,type[2]))) + { + skillratio = (sd->status.base_level + status_get_str(src) + status_get_dex(src)+ status_get_luk(src))/(skill<4?12-3*skill:1); + ATK_ADDRATE(skillratio); + } + else for (i = 0; i < 3; i++) { if (t_class == sd->hate_mob[i] && (skill = pc_checkskill(sd,type[i]))) { @@ -3826,6 +3831,7 @@ static const struct battle_data_short { { "mob_status_def_rate", &battle_config.mob_sc_def_rate }, { "pc_max_status_def", &battle_config.pc_max_sc_def }, { "mob_max_status_def", &battle_config.mob_max_sc_def }, + { "sg_miracle_skill_ratio", &battle_config.sg_miracle_skill_ratio }, }; static const struct battle_data_int { @@ -3861,6 +3867,8 @@ static const struct battle_data_int { { "day_duration", &battle_config.day_duration }, // added by [Yor] { "night_duration", &battle_config.night_duration }, // added by [Yor] { "mob_remove_delay", &battle_config.mob_remove_delay }, + { "sg_miracle_skill_duration", &battle_config.sg_miracle_skill_duration }, + }; int battle_set_value(char *w1, char *w2) { @@ -4221,6 +4229,8 @@ void battle_set_defaults() { battle_config.mob_sc_def_rate = 100; battle_config.pc_max_sc_def = 10000; battle_config.mob_max_sc_def = 5000; + battle_config.sg_miracle_skill_ratio=1; + battle_config.sg_miracle_skill_duration=600000; } void battle_validate_conf() { @@ -4413,6 +4423,9 @@ void battle_validate_conf() { battle_config.pc_max_sc_def = 10000; if (battle_config.mob_max_sc_def > 10000) battle_config.mob_max_sc_def = 10000; + if (battle_config.sg_miracle_skill_ratio > 10000) + battle_config.sg_miracle_skill_ratio = 10000; + #ifdef CELL_NOSTACK if (battle_config.cell_stack_limit < 1) battle_config.cell_stack_limit = 1; diff --git a/src/map/battle.h b/src/map/battle.h index 92828223e..09eddf294 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -427,6 +427,9 @@ extern struct Battle_Config { unsigned short pc_max_sc_def; unsigned short mob_max_sc_def; + unsigned short sg_miracle_skill_ratio; + int sg_miracle_skill_duration; + } battle_config; void do_init_battle(void); diff --git a/src/map/mob.c b/src/map/mob.c index 6be660c9e..af8cb9dea 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2474,7 +2474,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) per *= 1.15; // pk_mode additional exp if monster >20 levels [Valaris] //SG additional exp from Blessings [Komurka] - probably can be optimalized ^^;; - if(md->class_ == tmpsd[i]->hate_mob[0] && (battle_config.allow_skill_without_day || is_day_of_sun())) + if (tmpsd[i]->sc.data[SC_MIRACLE].timer!=-1) + per += per*20*pc_checkskill(tmpsd[i],SG_STAR_BLESS)/100.; + else if(md->class_ == tmpsd[i]->hate_mob[0] && (battle_config.allow_skill_without_day || is_day_of_sun())) per += per*10*pc_checkskill(tmpsd[i],SG_SUN_BLESS)/100.; else if(md->class_ == tmpsd[i]->hate_mob[1] && (battle_config.allow_skill_without_day || is_day_of_moon())) per += per*10*pc_checkskill(tmpsd[i],SG_MOON_BLESS)/100.; diff --git a/src/map/pc.c b/src/map/pc.c index 0d10dfc69..216d9cfd2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3728,6 +3728,13 @@ int pc_walktoxy (struct map_session_data *sd, int x, int y) map_foreachinrange(skill_guildaura_sub, &sd->bl,2, BL_PC, sd->bl.id, sd->status.guild_id, &guildflag); } + //SG_MIRACLE [Komurka] + if (sd->sc.data && sd->sc.data[SC_MIRACLE].timer==-1 && ((sd->status.class_==JOB_STAR_GLADIATOR) || (sd->status.class_==JOB_STAR_GLADIATOR2)) && (rand()%10000 < battle_config.sg_miracle_skill_ratio) ) + { + clif_displaymessage(sd->fd,"[Miracle of the Sun, Moon and Stars]"); + status_change_start(&sd->bl,SC_MIRACLE,100, + 1,0,0,0,battle_config.sg_miracle_skill_duration,0); + } return 0; } diff --git a/src/map/skill.c b/src/map/skill.c index d18b87c22..405e5a109 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -7968,36 +7968,37 @@ int skill_check_condition(struct map_session_data *sd,int type) clif_skill_fail(sd,skill,0,0); return 0; } + //SHOULD BE OPTIMALIZED [Komurka] case SG_SUN_WARM: - if(sd->bl.m == sd->feel_map[0].m) + if ((sd->bl.m == sd->feel_map[0].m) || (sd->sc.data[SC_MIRACLE].timer!=-1)) break; clif_skill_fail(sd,skill,0,0); return 0; break; case SG_MOON_WARM: - if(sd->bl.m == sd->feel_map[1].m) + if ((sd->bl.m == sd->feel_map[1].m) || (sd->sc.data[SC_MIRACLE].timer!=-1)) break; clif_skill_fail(sd,skill,0,0); return 0; break; case SG_STAR_WARM: - if(sd->bl.m == sd->feel_map[2].m) + if ((sd->bl.m == sd->feel_map[2].m) || (sd->sc.data[SC_MIRACLE].timer!=-1)) break; clif_skill_fail(sd,skill,0,0); return 0; break; case SG_SUN_COMFORT: - if(sd->bl.m == sd->feel_map[0].m && (battle_config.allow_skill_without_day || is_day_of_sun())) + if ((sd->bl.m == sd->feel_map[0].m && (battle_config.allow_skill_without_day || is_day_of_sun())) || (sd->sc.data[SC_MIRACLE].timer!=-1)) break; clif_skill_fail(sd,skill,0,0); return 0; case SG_MOON_COMFORT: - if(sd->bl.m == sd->feel_map[1].m && (battle_config.allow_skill_without_day || is_day_of_moon())) + if ((sd->bl.m == sd->feel_map[1].m && (battle_config.allow_skill_without_day || is_day_of_moon())) || (sd->sc.data[SC_MIRACLE].timer!=-1)) break; clif_skill_fail(sd,skill,0,0); return 0; case SG_STAR_COMFORT: - if(sd->bl.m == sd->feel_map[2].m && (battle_config.allow_skill_without_day || is_day_of_star())) + if ((sd->bl.m == sd->feel_map[2].m && (battle_config.allow_skill_without_day || is_day_of_star())) || (sd->sc.data[SC_MIRACLE].timer!=-1)) break; clif_skill_fail(sd,skill,0,0); return 0; diff --git a/src/map/status.c b/src/map/status.c index 1dc45a26f..6c1350a0f 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -302,6 +302,7 @@ void initChangeTables(void) { StatusIconChangeTable[SC_ASPDPOTION3] = SI_ASPDPOTION; StatusIconChangeTable[SC_SPEEDUP0] = SI_SPEEDPOTION; StatusIconChangeTable[SC_SPEEDUP1] = SI_SPEEDPOTION; + StatusIconChangeTable[SC_MIRACLE] = SI_SPIRIT; //Guild skills don't fit due to their range being beyond MAX_SKILL StatusIconChangeTable[SC_GUILDAURA] = SI_GUILDAURA; @@ -4366,6 +4367,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val case SC_STEELBODY: // case SC_SKA: case SC_TWOHANDQUICKEN: /* 2HQ */ + case SC_MIRACLE: calc_flag = 1; break; diff --git a/src/map/status.h b/src/map/status.h index 2ad97bf9b..13989080f 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -229,6 +229,7 @@ enum { SC_SWOO, // [marquis007] SC_SKA, // [marquis007] SC_TKDORI, // [marquis007] + SC_MIRACLE, //SG 'hidden' skill [Komurka] // SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex] }; -- cgit v1.2.3-70-g09d2