Преглед изворни кода

- Some cleanups and corrections in battle.c to account for negative (absorbed) damage.
- Fixed umbala.txt's Elemental Stones Quest bug. Thanks to Vhan Morthis.


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

skotlex пре 19 година
родитељ
комит
44a9bcba8f
5 измењених фајлова са 20 додато и 16 уклоњено
  1. 2 0
      Changelog-Trunk.txt
  2. 2 0
      npc/Changelog.txt
  3. 2 2
      npc/cities/umbala.txt
  4. 14 13
      src/map/battle.c
  5. 0 1
      src/map/status.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ 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/06/19
+	* Some cleanups and corrections in battle.c to account for negative
+	  (absorbed) damage. [Skotlex]
 	* Fixed fame-list updating crashing char-sql server when the given char-id
 	  just got into ranking. [Skotlex]
 	* Added missing Arunafeltz maps with information from NLZ [Evera]

+ 2 - 0
npc/Changelog.txt

@@ -37,6 +37,8 @@ Musashiden
 Date		Added
 ======
 06/19
+	* Fixed umbala.txt's Elemental Stones Quest bug. Thanks to Vhan Morthis.
+	  [Skotlex]
 	* Removed Jfunc1-1.txt, merged parts of scripts back. Changed job numbers to constants [Lupus]
 	- Jfunc2-1.txt & Jfunc2-2.txt todo
 06/17

+ 2 - 2
npc/cities/umbala.txt

@@ -580,7 +580,7 @@ umbala.gat,221,193,1	script	 #Skeletal Gate	111,{
 				if(event_umbala < 6) goto LSecondCheck;
 					if(@ryumon == 33) goto Lwarp;
 				LSecondCheck:
-				if(event_umbala >= 6) goto LLNewEnd;
+				if(event_umbala >= 6) goto LNewEnd;
 					if(@ryumon == 13) goto Lwarp;
 					LNewEnd:
 						mes "^3355FFNothing happened.";
@@ -1684,4 +1684,4 @@ L4:
 umbala.gat,136,195,0	script	#Warp Point	139,1,1,{
 	warp "umbala.gat",145,166;
 	end;
-}
+}

+ 14 - 13
src/map/battle.c

@@ -232,8 +232,8 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
 
 	nullpo_retr(0, bl);
 
-	if (damage <= 0)
-		return 0;
+	if (damage <= 0) //No reductions to make.
+		return damage;
 	
 	if (bl->type == BL_MOB) {
 		md=(struct mob_data *)bl;
@@ -457,8 +457,8 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
 	struct mob_data *md = NULL;
 	int class_;
 
-	if (damage <= 0)
-		return 0;
+	if (damage <= 0) //No reductions to make.
+		return damage;
 	
 	class_ = status_get_class(bl);
 
@@ -1720,7 +1720,7 @@ static struct Damage battle_calc_weapon_attack(
 		}
 	}
 
-	if ((!flag.rh || wd.damage == 0) && (!flag.lh || wd.damage2 == 0))
+	if ((!flag.rh || !wd.damage) && (!flag.lh || !wd.damage2))
 		flag.cardfix = 0;	//When the attack does no damage, avoid doing %bonuses
 
 	if (sd)
@@ -1877,13 +1877,13 @@ static struct Damage battle_calc_weapon_attack(
 			flag.lh=0;
 		} else if(sd->status.weapon > MAX_WEAPON_TYPE)
 		{	//Dual-wield
-			if (wd.damage > 0)
+			if (wd.damage)
 			{
 				skill = pc_checkskill(sd,AS_RIGHT);
 				wd.damage = wd.damage * (50 + (skill * 10))/100;
 				if(wd.damage < 1) wd.damage = 1;
 			}
-			if (wd.damage2 > 0)
+			if (wd.damage2)
 			{
 				skill = pc_checkskill(sd,AS_LEFT);
 				wd.damage2 = wd.damage2 * (30 + (skill * 10))/100;
@@ -1894,7 +1894,7 @@ static struct Damage battle_calc_weapon_attack(
 			skill = pc_checkskill(sd,TF_DOUBLE);
 			wd.damage2 = wd.damage * (1 + (skill * 2))/100;
 
-			if(wd.damage > 0 && wd.damage2 < 1) wd.damage2 = 1;
+			if(wd.damage && !wd.damage2) wd.damage2 = 1;
 			flag.lh = 1;
 		}
 	}
@@ -1907,11 +1907,12 @@ static struct Damage battle_calc_weapon_attack(
 	
 	if(wd.damage > 0 || wd.damage2 > 0)
 	{
-		if(wd.damage2<1) {
+		if(!wd.damage2) {
 			wd.damage=battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
 			if (map_flag_gvg(target->m))
 				wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
-		} else if(wd.damage<1) {
+		} else
+		if(!wd.damage) {
 			wd.damage2=battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
 			if (map_flag_gvg(target->m))
 				wd.damage2=battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
@@ -1949,7 +1950,7 @@ static struct Damage battle_calc_weapon_attack(
 		}
 	}
 	
-	if (wd.damage > 0 || wd.damage2 > 0) {
+	if (wd.damage || wd.damage2) {
 		if (sd && battle_config.equip_self_break_rate)
 		{	// Self weapon breaking
 			int breakrate = battle_config.equip_natural_break_rate;
@@ -2360,8 +2361,8 @@ struct Damage battle_calc_magic_attack(
 
 	damage_div_fix(ad.damage, ad.div_);
 	
-	if (flag.infdef && ad.damage > 0)
-		ad.damage = 1;
+	if (flag.infdef && ad.damage)
+		ad.damage/= ad.damage; //Why this? Because, well, if damage is absorbed, it should heal 1, not do 1 dmg.
 		
 	ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
 	if (map_flag_gvg(target->m))

+ 0 - 1
src/map/status.c

@@ -5157,7 +5157,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 		case SC_CLOSECONFINE2:
 		case SC_ANKLE:
 		case SC_SPIDERWEB:
-		case SC_MADNESSCANCEL:
 			unit_stop_walking(bl,1);
 		break;
 		case SC_HIDING: