Bläddra i källkod

- Modified battle_calc_weapon_attack to use new flags pdef/pdef (pierce defense), Investigate and Icepick will now use the final def/vit-def values rather than the base ones.
- The move-enable condition checks for skills are now checked for only when on skill use, not at cast-end time.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6714 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 år sedan
förälder
incheckning
ed8a9e9848
3 ändrade filer med 32 tillägg och 17 borttagningar
  1. 5 0
      Changelog-Trunk.txt
  2. 19 13
      src/map/battle.c
  3. 8 4
      src/map/skill.c

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ 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/23
+	* Modified battle_calc_weapon_attack to use new flags pdef/pdef (pierce
+	  defense), Investigate and Icepick will now use the final def/vit-def values
+	  rather than the base ones. [Skotlex]
+	* The move-enable condition checks for skills are now checked for only when
+	  on skill use, not at cast-end time. [Skotlex]
 	* Corrected clif parse name request failing on disguised characters [Skotlex]
 	* Corrected Soul Drain draining from all non-ground-based skills including
 	  non-magic attacks. [Skotlex]

+ 19 - 13
src/map/battle.c

@@ -995,6 +995,8 @@ static struct Damage battle_calc_weapon_attack(
 		unsigned cri : 1;		//Critical hit
 		unsigned idef : 1;	//Ignore defense
 		unsigned idef2 : 1;	//Ignore defense (left weapon)
+		unsigned pdef : 2;	//Pierces defense (Investigate/Ice Pick)
+		unsigned pdef2 : 2;	//1: Use def+def2/50, 2: Use def+def2/100	
 		unsigned infdef : 1;	//Infinite defense (plants)
 		unsigned arrow : 1;	//Attack is arrow-based
 		unsigned rh : 1;		//Attack considers right hand (wd.damage)
@@ -1606,6 +1608,7 @@ static struct Damage battle_calc_weapon_attack(
 					break;
 				case MO_INVESTIGATE:
 					skillratio += 75*skill_lv;
+					flag.pdef = flag.pdef2 = 2;
 					break;
 				case MO_EXTREMITYFIST:
 					if (sd)
@@ -1822,25 +1825,21 @@ static struct Damage battle_calc_weapon_attack(
 				&& skill_num != CR_GRANDCROSS && skill_num != NPC_GRANDDARKNESS
 			  	&& !flag.cri)
 			{	//Elemental/Racial adjustments
-				char raceele_flag=0, raceele_flag_=0;
 				if(sd->right_weapon.def_ratio_atk_ele & (1<<t_ele) ||
 					sd->right_weapon.def_ratio_atk_race & (1<<t_race) ||
 					sd->right_weapon.def_ratio_atk_race & (is_boss(target)?1<<10:1<<11)
 				)
-					raceele_flag = flag.idef = 1;
+					flag.pdef = 1;
 
 				if(sd->left_weapon.def_ratio_atk_ele & (1<<t_ele) ||
 					sd->left_weapon.def_ratio_atk_race & (1<<t_race) ||
 					sd->left_weapon.def_ratio_atk_race & (is_boss(target)?1<<10:1<<11)
 				) {	//Pass effect onto right hand if configured so. [Skotlex]
 					if (battle_config.left_cardfix_to_right && flag.rh)
-						raceele_flag = flag.idef = 1;
+						flag.pdef = 1;
 					else
-						raceele_flag_ = flag.idef2 = 1;
+						flag.pdef2 = 1;
 				}
-
-				if (raceele_flag || raceele_flag_)
-					ATK_RATE2(raceele_flag?(def1 + def2):100, raceele_flag_?(def1 + def2):100);
 			}
 
 			if (skill_num != CR_GRANDCROSS && skill_num != NPC_GRANDDARKNESS)
@@ -1911,12 +1910,19 @@ static struct Damage battle_calc_weapon_attack(
 				vit_def += def1*battle_config.pet_defense_type;
 				def1 = 0;
 			}
-			if(skill_num == MO_INVESTIGATE) { //Must use adjusted defense
-				ATK_RATE(2*(def1 + vit_def));
-			} else {
-				ATK_RATE2(flag.idef?100:100-def1, flag.idef2?100:100-def1);
-				ATK_ADD2(flag.idef?0:-vit_def, flag.idef2?0:-vit_def);
-			}
+			if (def1 > 100) def1 = 100;
+			ATK_RATE2(
+				flag.idef ?100:
+				(flag.pdef ?flag.pdef *(def1 + vit_def):
+				100-def1),
+			  	flag.idef2?100:
+				(flag.pdef2?flag.pdef2*(def1 + vit_def):
+				100-def1)
+			);
+			ATK_ADD2(
+				flag.idef ||flag.pdef ?0:-vit_def,
+				flag.idef2||flag.pdef2?0:-vit_def
+			);
 		}
 
 		//Post skill/vit reduction damage increases

+ 8 - 4
src/map/skill.c

@@ -7528,7 +7528,10 @@ int skill_isammotype(TBL_PC *sd, int skill)
 }
 
 /*==========================================
- * ƒXƒLƒ‹Žg—p?Œ??i?‚ÅŽg—pޏ”s?j
+ * Checks that you have the requirements for casting a skill.
+ * Flag:
+ * &1: finished casting the skill (invoke hp/sp/item consumption)
+ * &2: picked menu entry (Warp Portal, Teleport and other menu based skills)
  *------------------------------------------
  */
 int skill_check_condition(struct map_session_data *sd,int skill, int lv, int type)
@@ -7756,7 +7759,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
 		if(sd->sc.data[SC_COMBO].val1 != MO_COMBOFINISH && sd->sc.data[SC_COMBO].val1 != CH_TIGERFIST)
 			return 0;
 		break;
-	case MO_EXTREMITYFIST:					// ˆ¢?C—…”e–PŒ?
+	case MO_EXTREMITYFIST:
 //		if(sd->sc.data[SC_EXTREMITYFIST].timer != -1) //To disable Asura during the 5 min skill block uncomment this...
 //			return 0;
 		if(sd->sc.data[SC_BLADESTOP].timer!=-1)
@@ -7769,7 +7772,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
 			else if (sd->sc.data[SC_COMBO].val1 == CH_CHAINCRUSH)
 				spiritball = sd->spiritball?sd->spiritball:1;
 			//It should consume whatever is left as long as it's at least 1.
-		} else if(!unit_can_move(&sd->bl))
+		} else if(!type && !unit_can_move(&sd->bl)) //Check only on begin casting.
 	  	{	//Placed here as ST_MOVE_ENABLE should not apply if rooted or on a combo. [Skotlex]
 			clif_skill_fail(sd,skill,0,0);
 			return 0;
@@ -8162,7 +8165,8 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
 		}
 		break;
 	case ST_MOVE_ENABLE:
-		if(!unit_can_move(&sd->bl)) {
+		//Check only on begin casting. [Skotlex]
+		if(!type && !unit_can_move(&sd->bl)) {
 			clif_skill_fail(sd,skill,0,0);
 			return 0;
 		}