From 7f8b9c43c55119e7d76b3a8e24fb87f6bae38043 Mon Sep 17 00:00:00 2001 From: Aleos <aleos89@users.noreply.github.com> Date: Thu, 3 May 2018 12:11:03 -0400 Subject: [PATCH] Corrected Demonic Fire and FE Acid behavior (#3088) * Fixes #1086, fixes #2799, and fixes #3049. * Fire Expansion Level 1 now lasts 10 seconds longer with stacked with Demonic Fire. * Fire Expansion Tear Gas will no longer damage players on non-PvP type maps. * Fire Expansion Acid is now misc type instead of magic. * Corrected a possible map crash with Demonic Fire and Fire Expansion interactions. * Demonic Fire can only have one instance on the ground at a time. * Miscellaneous cleanups. Thanks to @jamon18, @uddevil, and @LolyAll! --- db/pre-re/skill_db.txt | 4 +-- db/re/skill_db.txt | 4 +-- src/map/battle.cpp | 21 ++------------ src/map/skill.cpp | 65 +++++++++++++++++++++++------------------- 4 files changed, 42 insertions(+), 52 deletions(-) diff --git a/db/pre-re/skill_db.txt b/db/pre-re/skill_db.txt index cf7b7431ee..2777f48405 100644 --- a/db/pre-re/skill_db.txt +++ b/db/pre-re/skill_db.txt @@ -1235,11 +1235,11 @@ 2482,11,6,2,0,0x8,0,5,1,yes,0,0,1,weapon,2,0x0, GN_WALLOFTHORN,Wall of Thorns 2483,11,6,2,0,0x3,4,10,1,yes,0,0x0,0,weapon,0,0x1, GN_CRAZYWEED,Crazy Weed 2484,0,6,2,2,0x2,2,10,1,no,0,0x40000,0,weapon,0,0x1, GN_CRAZYWEED_ATK,Crazy Weed Attack -2485,9,6,2,3,0,0,5,1,yes,0,0,0,magic,0,0x0, GN_DEMONIC_FIRE,Demonic Fire +2485,9,6,2,3,0,0,5,1,yes,0,0,1,magic,0,0x0, GN_DEMONIC_FIRE,Demonic Fire 2486,9,6,2,0,0,0,5,1,yes,0,0,0,none,0,0x0, GN_FIRE_EXPANSION,Fire Expansion 2487,9,6,2,0,0,0,1,1,no,0,0,0,none,0,0x0, GN_FIRE_EXPANSION_SMOKE_POWDER,Fire Expansion Smoke Powder 2488,9,6,2,0,0,0,1,1,no,0,0,0,none,0,0x0, GN_FIRE_EXPANSION_TEAR_GAS,Fire Expansion Tear Gas -2489,11,8,1,-1,0x28,0,10,1:2:3:4:5:6:7:8:9:10,no,0,0,0,magic,0,0x0, GN_FIRE_EXPANSION_ACID,Fire Expansion Acid +2489,11,8,1,0,0x40,0,10,1:2:3:4:5:6:7:8:9:10,no,0,0x18000,0,misc,0,0x0, GN_FIRE_EXPANSION_ACID,Fire Expansion Acid 2490,9,6,2,0,0x3,1,5,1,yes,0,0x80,2:3:4:5:6,misc,0,0x0, GN_HELLS_PLANT,Hell's Plant 2491,0,6,1,0,0x90,0,5,1,no,0,0,0,misc,0,0x0, GN_HELLS_PLANT_ATK,Hell's Plant Attack 2492,0,6,4,0,0x3,5:6:6:7:7,5,1,yes,0,0,0,none,0,0x0, GN_MANDRAGORA,Howling of Mandragora diff --git a/db/re/skill_db.txt b/db/re/skill_db.txt index d63d42c4ed..ae740297be 100644 --- a/db/re/skill_db.txt +++ b/db/re/skill_db.txt @@ -1235,11 +1235,11 @@ 2482,11,6,2,0,0x8,0,5,1,yes,0,0,1,weapon,2,0x0, GN_WALLOFTHORN,Wall of Thorns 2483,11,6,2,0,0x3,4,10,1,yes,0,0x0,0,weapon,0,0x1, GN_CRAZYWEED,Crazy Weed 2484,0,6,2,2,0x2,2,10,1,no,0,0x40000,0,weapon,0,0x1, GN_CRAZYWEED_ATK,Crazy Weed Attack -2485,9,6,2,3,0,0,5,1,yes,0,0,0,magic,0,0x0, GN_DEMONIC_FIRE,Demonic Fire +2485,9,6,2,3,0,0,5,1,yes,0,0,1,magic,0,0x0, GN_DEMONIC_FIRE,Demonic Fire 2486,9,6,2,0,0,0,5,1,yes,0,0,0,none,0,0x0, GN_FIRE_EXPANSION,Fire Expansion 2487,9,6,2,0,0,0,1,1,no,0,0,0,none,0,0x0, GN_FIRE_EXPANSION_SMOKE_POWDER,Fire Expansion Smoke Powder 2488,9,6,2,0,0,0,1,1,no,0,0,0,none,0,0x0, GN_FIRE_EXPANSION_TEAR_GAS,Fire Expansion Tear Gas -2489,11,8,1,-1,0x28,0,10,1:2:3:4:5:6:7:8:9:10,no,0,0,0,magic,0,0x0, GN_FIRE_EXPANSION_ACID,Fire Expansion Acid +2489,11,8,1,0,0x60,0,10,1:2:3:4:5:6:7:8:9:10,no,0,0x18000,0,misc,0,0x0, GN_FIRE_EXPANSION_ACID,Fire Expansion Acid 2490,9,6,2,0,0x3,1,5,1,yes,0,0x80,2:3:4:5:6,misc,0,0x0, GN_HELLS_PLANT,Hell's Plant 2491,0,6,1,0,0x90,0,5,1,no,0,0,0,misc,0,0x0, GN_HELLS_PLANT_ATK,Hell's Plant Attack 2492,0,6,4,0,0x3,5:6:6:7:7,5,1,yes,0,0,0,none,0,0x0, GN_MANDRAGORA,Howling of Mandragora diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 9e2e32714c..9e0a856a84 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -1270,7 +1270,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam { struct status_change *d_sc = status_get_sc(d_bl); - if( d_sc && d_sc->data[SC_DEFENDER] && (flag&(BF_LONG|BF_MAGIC)) == BF_LONG && skill_id != ASC_BREAKER && skill_id != CR_ACIDDEMONSTRATION && skill_id != NJ_ZENYNAGE && skill_id != KO_MUCHANAGE ) + if( d_sc && d_sc->data[SC_DEFENDER] && (flag&(BF_LONG|BF_MAGIC)) == BF_LONG && skill_id != ASC_BREAKER && skill_id != CR_ACIDDEMONSTRATION && skill_id != NJ_ZENYNAGE && skill_id != GN_FIRE_EXPANSION_ACID && skill_id != KO_MUCHANAGE ) damage -= damage * d_sc->data[SC_DEFENDER]->val2 / 100; } } @@ -1289,7 +1289,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if (sc->data[SC_DEFENDER] && skill_id != NJ_ZENYNAGE && skill_id != KO_MUCHANAGE && #ifdef RENEWAL - ((flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON) || skill_id == CR_ACIDDEMONSTRATION)) + ((flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON) || skill_id == CR_ACIDDEMONSTRATION || skill_id == GN_FIRE_EXPANSION_ACID)) #else (flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON)) #endif @@ -5825,22 +5825,6 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list case AB_RENOVATIO: ad.damage = status_get_lv(src) * 10 + sstatus->int_; break; - case GN_FIRE_EXPANSION_ACID: -#ifdef RENEWAL - { - struct Damage wd = battle_calc_weapon_attack(src, target, skill_id, skill_lv, 0); - - ad.damage = (int64)(7 * ((wd.damage / skill_lv + ad.damage / skill_lv) * tstatus->vit / 100)); - } -#else - if(tstatus->vit + sstatus->int_) - ad.damage = (int64)(7 * tstatus->vit * sstatus->int_ * sstatus->int_ / (10 * (tstatus->vit + sstatus->int_))); - else - ad.damage = 0; - if(tsd) - ad.damage >>= 1; -#endif - break; default: { if (sstatus->matk_max > sstatus->matk_min) { MATK_ADD(sstatus->matk_min+rnd()%(sstatus->matk_max-sstatus->matk_min)); @@ -6584,6 +6568,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * } break; case CR_ACIDDEMONSTRATION: + case GN_FIRE_EXPANSION_ACID: #ifdef RENEWAL // Official Renewal formula [helvetica] // damage = 7 * ((atk + matk)/skill level) * (target vit/100) diff --git a/src/map/skill.cpp b/src/map/skill.cpp index 7979dd3c58..d8dae65588 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -4933,6 +4933,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case SO_VARETYR_SPEAR: case GN_CART_TORNADO: case GN_CARTCANNON: + case GN_DEMONIC_FIRE: + case GN_FIRE_EXPANSION_ACID: case KO_HAPPOKUNAI: case KO_HUUMARANKA: case KO_MUCHANAGE: @@ -5798,12 +5800,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } break; - case GN_DEMONIC_FIRE: - case GN_FIRE_EXPANSION_ACID: - if (flag&1) - skill_attack(BF_MAGIC, src, src, bl, skill_id, skill_lv, tick, flag); - break; - case KO_JYUMONJIKIRI: { short x, y; short dir = map_calc_dir(src,bl->x,bl->y); @@ -11752,7 +11748,6 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case SO_PSYCHIC_WAVE: case SO_VACUUM_EXTREME: case GN_THORNS_TRAP: - case GN_DEMONIC_FIRE: case GN_HELLS_PLANT: case SO_EARTHGRAVE: case SO_DIAMONDDUST: @@ -11773,6 +11768,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui flag|=1;//Set flag to 1 to prevent deleting ammo (it will be deleted on group-delete). case GS_GROUNDDRIFT: //Ammo should be deleted right away. case GN_WALLOFTHORN: + case GN_DEMONIC_FIRE: skill_unitsetting(src,skill_id,skill_lv,x,y,0); break; case WZ_ICEWALL: @@ -12255,40 +12251,43 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if( !ud ) break; - for( i_su = 0; i_su < MAX_SKILLUNITGROUP && ud->skillunit[i_su]; i_su ++ ) { - if( ud->skillunit[i_su]->skill_id == GN_DEMONIC_FIRE && - distance_xy(x, y, ud->skillunit[i_su]->unit->bl.x, ud->skillunit[i_su]->unit->bl.y) < 4 ) { - switch( skill_lv ) { - case 1: - ud->skillunit[i_su]->unit->val2 = skill_lv; - ud->skillunit[i_su]->unit->group->val2 = skill_lv; + for(i_su = 0; i_su < MAX_SKILLUNITGROUP && ud->skillunit[i_su]; i_su++) { + struct skill_unit *su = ud->skillunit[i_su]->unit; + struct skill_unit_group *sg = ud->skillunit[i_su]->unit->group; + + if (ud->skillunit[i_su]->skill_id == GN_DEMONIC_FIRE && distance_xy(x, y, su->bl.x, su->bl.y) < 4) { + switch (skill_lv) { + case 1: { + int duration = sg->limit - DIFF_TICK(tick, sg->tick); + + skill_delunit(su); + skill_unitsetting(src, GN_DEMONIC_FIRE, 1, x, y, duration); + flag |= 1; + } break; case 2: - map_foreachinallarea(skill_area_sub,src->m, - ud->skillunit[i_su]->unit->bl.x - 2,ud->skillunit[i_su]->unit->bl.y - 2, - ud->skillunit[i_su]->unit->bl.x + 2,ud->skillunit[i_su]->unit->bl.y + 2, BL_CHAR, - src, GN_DEMONIC_FIRE, skill_lv + 20, tick, flag|BCT_ENEMY|SD_LEVEL|1, skill_castend_damage_id); - skill_delunit(ud->skillunit[i_su]->unit); + map_foreachinallarea(skill_area_sub, src->m, su->bl.x - 2, su->bl.y - 2, su->bl.x + 2, su->bl.y + 2, BL_CHAR, src, GN_DEMONIC_FIRE, skill_lv + 20, tick, flag|BCT_ENEMY|SD_LEVEL|1, skill_castend_damage_id); + if (su != NULL) + skill_delunit(su); break; case 3: - skill_delunit(ud->skillunit[i_su]->unit); + skill_delunit(su); skill_unitsetting(src, GN_FIRE_EXPANSION_SMOKE_POWDER, 1, x, y, 0); flag |= 1; break; case 4: - skill_delunit(ud->skillunit[i_su]->unit); + skill_delunit(su); skill_unitsetting(src, GN_FIRE_EXPANSION_TEAR_GAS, 1, x, y, 0); flag |= 1; break; case 5: { - int acid_lv = 5; // Cast at Acid Demonstration at level 5 unless the user has a higher level learned. - if( sd && pc_checkskill(sd, CR_ACIDDEMONSTRATION) > 5 ) - acid_lv = pc_checkskill(sd, CR_ACIDDEMONSTRATION); - map_foreachinallarea(skill_area_sub, src->m, - ud->skillunit[i_su]->unit->bl.x - 2, ud->skillunit[i_su]->unit->bl.y - 2, - ud->skillunit[i_su]->unit->bl.x + 2, ud->skillunit[i_su]->unit->bl.y + 2, BL_CHAR, - src, GN_FIRE_EXPANSION_ACID, acid_lv, tick, flag|BCT_ENEMY|SD_LEVEL|1, skill_castend_damage_id); - skill_delunit(ud->skillunit[i_su]->unit); + uint16 acid_lv = 5; // Cast at Acid Demonstration at level 5 unless the user has a higher level learned. + + if (sd && pc_checkskill(sd, CR_ACIDDEMONSTRATION) > 5) + acid_lv = pc_checkskill(sd, CR_ACIDDEMONSTRATION); + map_foreachinallarea(skill_area_sub, src->m, su->bl.x - 2, su->bl.y - 2, su->bl.x + 2, su->bl.y + 2, BL_CHAR, src, GN_FIRE_EXPANSION_ACID, acid_lv, tick, flag|BCT_ENEMY|SD_LEVEL|1, skill_castend_damage_id); + if (su != NULL) + skill_delunit(su); } break; } @@ -12998,6 +12997,12 @@ struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_ limit = 3000; val3 = (x<<16)|y; break; + case GN_DEMONIC_FIRE: + if (flag) { // Fire Expansion level 1 + limit = flag + 10000; + flag = 0; + } + break; case GN_FIRE_EXPANSION_SMOKE_POWDER: case GN_FIRE_EXPANSION_TEAR_GAS: limit = ((sd ? pc_checkskill(sd,GN_DEMONIC_FIRE) : 1) + 1) * limit; @@ -13487,7 +13492,7 @@ static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, un break; case UNT_FIRE_EXPANSION_TEAR_GAS: - if (!sce && battle_check_target(&unit->bl, bl, sg->target_flag) > 0) + if (!sce && battle_check_target(&unit->bl, bl, sg->target_flag) > 0 && map_flag_vs(bl->m)) if( sc_start4(ss, bl, type, 100, sg->skill_lv, 0, ss->id,0, sg->limit) ) sc_start(ss, bl, SC_TEARGAS_SOB, 100, sg->skill_lv, sg->limit); break;