summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-05-28 11:00:22 +0000
committerInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-05-28 11:00:22 +0000
commit8602a7a5b540436411328c3b42bbe465defa40b7 (patch)
tree194a5fb1ce272e352163ff84e29f31694731a5e7 /src/map/skill.c
parent083e1e7f223ca36cdda5bf02940dcbb59a18c466 (diff)
downloadhercules-8602a7a5b540436411328c3b42bbe465defa40b7.tar.gz
hercules-8602a7a5b540436411328c3b42bbe465defa40b7.tar.bz2
hercules-8602a7a5b540436411328c3b42bbe465defa40b7.tar.xz
hercules-8602a7a5b540436411328c3b42bbe465defa40b7.zip
* Fixed some issues of skill condition check.
- HP is now checked at the end of cast. - Lv 6-10 StoneCurse doesn't consume gems. - Tarotcard's after-cast delay will still be applied if it fails. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13816 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 20ec4292b..34c52a716 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4195,7 +4195,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
else if(sd) {
clif_skill_fail(sd,skillid,0,0);
// Level 6-10 doesn't consume a red gem if it fails [celest]
- if (skilllv > 5) break;
+ if (skilllv > 5)
+ { // not to consume items
+ map_freeblock_unlock();
+ return 0;
+ }
}
}
break;
@@ -5225,7 +5229,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case CG_TAROTCARD:
{
int eff, count = -1;
- if( (dstmd && ((dstmd->guardian_data && dstmd->class_ == MOBID_EMPERIUM) || mob_is_battleground(dstmd))) )
+ if( rand() % 100 > skilllv * 8 || (dstmd && ((dstmd->guardian_data && dstmd->class_ == MOBID_EMPERIUM) || mob_is_battleground(dstmd))) )
{
if( sd )
clif_skill_fail(sd,skillid,0,0);
@@ -5233,6 +5237,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
map_freeblock_unlock();
return 0;
}
+ status_zap(src,0,skill_db[skill_get_index(skillid)].sp[skilllv]); // consume sp only if succeeded [Inkfish]
do {
eff = rand() % 14;
clif_specialeffect(bl, 523 + eff, AREA);
@@ -8526,11 +8531,6 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
return 0;
}
- if( require.hp > 0 && status->hp <= (unsigned int)require.hp) {
- clif_skill_fail(sd,skill,2,0);
- return 0;
- }
-
if( require.sp > 0 && status->sp < (unsigned int)require.sp) {
clif_skill_fail(sd,skill,1,0);
return 0;
@@ -8552,6 +8552,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
int skill_check_condition_castend(struct map_session_data* sd, short skill, short lv)
{
struct skill_condition require;
+ struct status_data *status;
int i;
int index[MAX_SKILL_ITEM_REQUIRE];
@@ -8629,18 +8630,17 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
}
break;
}
- case CG_TAROTCARD:
- if( rand() % 100 > lv * 8 )
- {
- if( sd )
- clif_skill_fail(sd,skill,0,0);
- return 0;
- }
- break;
}
+ status = &sd->battle_status;
+
require = skill_get_requirement(sd,skill,lv);
+ if( require.hp > 0 && status->hp <= (unsigned int)require.hp) {
+ clif_skill_fail(sd,skill,2,0);
+ return 0;
+ }
+
if( require.ammo ) { //Skill requires stuff equipped in the arrow slot.
if((i=sd->equip_index[EQI_AMMO]) < 0 ||
!sd->inventory_data[i] ||
@@ -8822,6 +8822,9 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short
// Check for cost reductions due to skills & SCs
switch(skill) {
+ case CG_TAROTCARD:
+ req.sp = 0; // sp will be consumed in skill_cast_nodamage_id [Inkfish]
+ break;
case MC_MAMMONITE:
if(pc_checkskill(sd,BS_UNFAIRLYTRICK)>0)
req.zeny -= req.zeny*10/100;