Selaa lähdekoodia

- Fixed a possible null pointer in script command misc_effect
- Modified Investigate to take into consideration final def/vit-def rather than base values for damage adjustment.
- Added missing include unit.h in pet.c


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

skotlex 19 vuotta sitten
vanhempi
commit
98de35a4f7
4 muutettua tiedostoa jossa 21 lisäystä ja 10 poistoa
  1. 3 0
      Changelog-Trunk.txt
  2. 12 7
      src/map/battle.c
  3. 1 0
      src/map/pet.c
  4. 5 3
      src/map/script.c

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ 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/22
+	* Fixed a possible null pointer in script command misc_effect [Skotlex]
+	* Modified Investigate to take into consideration final def/vit-def rather
+	  than base values for damage adjustment. [Skotlex]
 	* WARNING: New scripting system contains memory leak
 	  TODO: Free all scripts using script_free_code() instead of old methods. [Lance]
 	* Excluded idle and auto-trade party members from TK_POWER list. [Lance]

+ 12 - 7
src/map/battle.c

@@ -1606,8 +1606,6 @@ static struct Damage battle_calc_weapon_attack(
 					break;
 				case MO_INVESTIGATE:
 					skillratio += 75*skill_lv;
-					ATK_RATE(2*(def1 + def2));
-					flag.idef= flag.idef2= 1;
 					break;
 				case MO_EXTREMITYFIST:
 					if (sd)
@@ -1903,15 +1901,22 @@ static struct Damage battle_calc_weapon_attack(
 				vit_def = def2 + (vit_def>0?rand()%vit_def:0);
 			}
 			
-			if (sd && battle_config.player_defense_type)
+			if (sd && battle_config.player_defense_type) {
 				vit_def += def1*battle_config.player_defense_type;
-			else if (md && battle_config.monster_defense_type)
+				def1 = 0;
+			} else if (md && battle_config.monster_defense_type) {
 				vit_def += def1*battle_config.monster_defense_type;
-			else if(pd && battle_config.pet_defense_type)
+				def1 = 0;
+			} else if(pd && battle_config.pet_defense_type) {
 				vit_def += def1*battle_config.pet_defense_type;
-			else
+				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);
+				ATK_ADD2(flag.idef?0:-vit_def, flag.idef2?0:-vit_def);
+			}
 		}
 
 		//Post skill/vit reduction damage increases

+ 1 - 0
src/map/pet.c

@@ -25,6 +25,7 @@
 #include "npc.h"
 #include "script.h"
 #include "skill.h"
+#include "unit.h"
 
 #define MIN_PETTHINKTIME 100
 

+ 5 - 3
src/map/script.c

@@ -8327,9 +8327,11 @@ int buildin_misceffect(struct script_state *st)
 	int type;
 
 	type=conv_num(st,& (st->stack->stack_data[st->start+2]));
-	if(st->oid)
-		clif_misceffect2(map_id2bl(st->oid),type);
-	else{
+	if(st->oid) {
+		struct block_list *bl = map_id2bl(st->oid);
+		if (bl)
+			clif_misceffect2(bl,type);
+	} else{
 		struct map_session_data *sd=script_rid2sd(st);
 		if(sd)
 			clif_misceffect2(&sd->bl,type);