summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt6
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/skill.c82
3 files changed, 49 insertions, 45 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 5c0f3093e..f1676a269 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,12 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/05
+ * Kaupe now will only block all skills of players, for non-players, only
+ normal attacks can be missed. [Skotlex]
+ * Moved the Kaite spell-reflect code after the damage calculation function,
+ so the reflected damage is exactly the damage the original target would
+ have received. Will only trigger if the damage to be reflected is above 0.
+ [Skotlex]
* OnEquip scripts will now trigger on log-on. [Skotlex]
* Infinite Endure will no longer give mdef bonus. [Skotlex]
* Removed bInfiniteEndure bonus, Eddga card now uses onequip/onunequip to
diff --git a/src/map/battle.c b/src/map/battle.c
index 8a66cbedf..b8426214a 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -461,8 +461,10 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
&& rand()%100 < 75 && !(skill_get_inf(skill_num)&INF_GROUND_SKILL))
return 0;
- if(sc->data[SC_KAUPE].timer != -1 && rand()%100 < sc->data[SC_KAUPE].val2)
- {
+ if(sc->data[SC_KAUPE].timer != -1 &&
+ rand()%100 < sc->data[SC_KAUPE].val2 &&
+ (bl->type == BL_PC || !skill_num))
+ { //Kaupe only blocks all skills of players.
clif_skill_nodamage(bl,bl,SL_KAUPE,1,1);
if (--sc->data[SC_KAUPE].val3 <= 0) //We make it work like Safety Wall, even though it only blocks 1 time.
status_change_end(bl, SC_KAUPE, -1);
diff --git a/src/map/skill.c b/src/map/skill.c
index 216132567..7cb552ab9 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1725,33 +1725,11 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
// Is this check really needed? FrostNova won't hurt you if you step right where the caster is?
if(skillid == WZ_FROSTNOVA && dsrc->x == bl->x && dsrc->y == bl->y) //使用スキルがフ?ストノヴァで?Adsrcとblが同じ??鰍ネら何もしない
return 0;
- if(sd && sd->chatID) //術者がPCでチャット中なら何もしない
- return 0;
-
-//何もしない判定ここまで
- sc= status_get_sc(bl);
- if (sc && !sc->count)
- sc = NULL; //Don't need it.
-
- if (attack_type&BF_MAGIC && sc && sc->data[SC_KAITE].timer != -1
- && !(status_get_mode(src)&MD_BOSS) && (sd || status_get_lv(dsrc) <= 80) //Works on players or mobs with level under 80.
- ) { //Bounce back the skill.
- clif_skill_nodamage(bl,bl,SL_KAITE,sc->data[SC_KAITE].val1,1);
- if (--sc->data[SC_KAITE].val2 <= 0)
- status_change_end(bl, SC_KAITE, -1);
- bl = src; //Just make the skill attack yourself @.@
- sc = status_get_sc(bl);
- tsd = (bl->type == BL_PC)?(struct map_session_data *)bl:NULL;
- if (sc && !sc->count)
- sc = NULL; //Don't need it.
- if (sc && sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_WIZARD)
- return 0; //Spirit of Wizard blocks bounced back spells.
- }
-
type=-1;
lv=(flag>>20)&0xf;
- dmg=battle_calc_attack(attack_type,src,bl,skillid,skilllv,flag&0xff ); //ダ??ジ計算
+ dmg=battle_calc_attack(attack_type,src,bl,skillid,skilllv,flag&0xff );
+
//Skotlex: Adjusted to the new system
if(src->type==BL_PET && (struct pet_data *)src)
@@ -1768,29 +1746,47 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
}
}
-//マジックロッド?理ここから
- if(attack_type&BF_MAGIC && sc && sc->data[SC_MAGICROD].timer != -1 && src == dsrc) { //魔法攻?でマジックロッド?態でsrc=dsrcなら
- dmg.damage = dmg.damage2 = 0; //ダメ?ジ0
- dmg.dmg_lv = ATK_FLEE; //This will prevent skill additional effect from taking effect. [Skotlex]
- if(tsd) {
- int sp = skill_get_sp(skillid,skilllv); //使用されたスキルのSPを吸?
- sp = sp * sc->data[SC_MAGICROD].val2 / 100; //吸?率計算
- if(skillid == WZ_WATERBALL && skilllv > 1) //ウォ?タ?ボ?ルLv1以上
- sp = sp/((skilllv|1)*(skilllv|1)); //さらに計算?
- if(sp > 0x7fff) sp = 0x7fff; //SP多すぎの場合は理論最大値
- else if(sp < 1) sp = 1; //1以下の場合は1
- if(tsd->status.sp + sp > tsd->status.max_sp) { //回復SP+現在のSPがMSPより大きい場合
- sp = tsd->status.max_sp - tsd->status.sp; //SPをMSP-現在SPにする
- tsd->status.sp = tsd->status.max_sp; //現在のSPにMSPを代入
+ sc= status_get_sc(bl);
+ if (sc && !sc->count) sc = NULL; //Don't need it.
+
+ if (attack_type&BF_MAGIC) {
+ if(sc && sc->data[SC_KAITE].timer != -1 && (dmg.damage || dmg.damage2)
+ && !(status_get_mode(src)&MD_BOSS) && (sd || status_get_lv(dsrc) <= 80)
+ ) { //Works on players or mobs with level under 80.
+ clif_skill_nodamage(bl,bl,SL_KAITE,sc->data[SC_KAITE].val1,1);
+ if (--sc->data[SC_KAITE].val2 <= 0)
+ status_change_end(bl, SC_KAITE, -1);
+ bl = src; //Just make the skill attack yourself @.@
+ sc = status_get_sc(bl);
+ tsd = (bl->type == BL_PC)?(TBL_PC*)bl:NULL;
+ if (sc && !sc->count)
+ sc = NULL; //Don't need it.
+ if (sc && sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_WIZARD)
+ { //Spirit of Wizard blocks bounced back spells.
+ dmg.damage = dmg.damage2 = 0;
+ dmg.dmg_lv = ATK_FLEE;
}
- else //回復SP+現在のSPがMSPより小さい場合は回復SPを加算
+ }
+
+ if(sc && sc->data[SC_MAGICROD].timer != -1 && src == dsrc) {
+ dmg.damage = dmg.damage2 = 0;
+ dmg.dmg_lv = ATK_FLEE; //This will prevent skill additional effect from taking effect. [Skotlex]
+ if(tsd) {
+ int sp = skill_get_sp(skillid,skilllv);
+ sp = sp * sc->data[SC_MAGICROD].val2 / 100;
+ if(skillid == WZ_WATERBALL && skilllv > 1)
+ sp = sp/((skilllv|1)*(skilllv|1)); //Estimate SP cost of a single water-ball
+ if(sp > SHRT_MAX) sp = SHRT_MAX;
+ else if(sp < 1) sp = 1;
+ if(sp > tsd->status.max_sp - tsd->status.sp)
+ sp = tsd->status.max_sp - tsd->status.sp;
tsd->status.sp += sp;
- clif_heal(tsd->fd,SP_SP,sp); //SP回復エフェクトの表示
- tsd->ud.canact_tick = tick + skill_delayfix(bl, SA_MAGICROD, sc->data[SC_MAGICROD].val1);
+ clif_heal(tsd->fd,SP_SP,sp);
+ tsd->ud.canact_tick = tick + skill_delayfix(bl, SA_MAGICROD, sc->data[SC_MAGICROD].val1);
+ }
+ clif_skill_nodamage(bl,bl,SA_MAGICROD,sc->data[SC_MAGICROD].val1,1);
}
- clif_skill_nodamage(bl,bl,SA_MAGICROD,sc->data[SC_MAGICROD].val1,1); //マジックロッドエフェクトを表示
}
-//マジックロッド?理ここまで
damage = dmg.damage + dmg.damage2;