Ver Fonte

- Gravitional Field is now a MISC type of attack.
- battle_calc_return_damage now is only for BF_WEAPON attacks, added skill_magic_reflect to check whether a spell is bounced back or not.
- Magic reflection now effectively switches the caster/target (after damage has been calculated)
- Now when GTB completely blocks a spell, the spell animation will still come off, but with a single bolt and MISS damage.
- Removed hom_setting&0x2 since Homunculus can be hit by land spells.
- Monster Property now gives a Skill Failed message when attempted on players.


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

skotlex há 17 anos atrás
pai
commit
c6d05bc0f3
7 ficheiros alterados com 88 adições e 60 exclusões
  1. 11 0
      Changelog-Trunk.txt
  2. 1 1
      conf-tmpl/battle/homunc.conf
  3. 3 0
      db/Changelog.txt
  4. 1 1
      db/skill_db.txt
  5. 23 43
      src/map/battle.c
  6. 1 1
      src/map/battle.h
  7. 48 14
      src/map/skill.c

+ 11 - 0
Changelog-Trunk.txt

@@ -3,6 +3,17 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/09/14
+	* Some changes brought up by AuronX (see topics 160295 and 149176):
+	* Gravitional Field is now a MISC type of attack.
+	* Magic reflection now effectively switches the caster/target (after damage
+	  has been calculated). Moved magic return and Magic Mirror code together
+	  with Kaite.
+	* Now when GTB completely blocks a spell, the spell animation will still
+	  come off, but with a single bolt and MISS damage.
+	* Removed hom_setting&0x2 since Homunculus can be hit by land spells.
+	* Monster Property now gives a Skill Failed message when attempted on
+	  players.
 2007/09/13
 	* Corrected SG Miracle to trigger per attack, not per walked tile. Trigger
 	  rate is now 0.02%

+ 1 - 1
conf-tmpl/battle/homunc.conf

@@ -24,7 +24,7 @@
 // Homunculus setting (Note 3)
 // Activates various 'quirks' that makes them behave unlike normal characters.
 // 0x001: Can't be targetted by support skills (except for their master)
-// 0x002: Immunity to land skills
+
 // 0x004: Mobs will always go after them instead of players until attacked
 // 0x008: Copy their master's speed on spawn/map-change
 // 0x010: They display luk/3+1 instead of their actual critical in the

+ 3 - 0
db/Changelog.txt

@@ -27,6 +27,9 @@
 	4425 Atros_Card			Chance that for 10 seconds your aspd will increase by 100% while attacking.
 
 ========================
+
+09/14
+	* Gravitional Field is now a MISC type of attack. [Skotlex]
 09/13
 	* Rev. 11191 Added a few more items. (idRO RIC items, etc) [L0ne_W0lf]
 	- RIC Stat Boost items will only last 1 minute until we have a proper time.

+ 1 - 1
db/skill_db.txt

@@ -523,7 +523,7 @@
 481,0,0,0,0,0,0,5,0,no,0,0,0,none,0	//HP_MANARECHARGE#Mana Recharge#
 482,0,6,4,0,0x1,0,5,1,no,0,0,0,magic,0	//PF_DOUBLECASTING#Double Casting#
 483,9,6,2,0,0x1,1:2:3:4:5,1,1,no,0,0,0,none,0	//HW_GANBANTEIN#Ganbantein#
-484,9,6,2,2,0xB1,0,5,1,yes,0,0,0,magic,0	//HW_GRAVITATION#Gravity Field#
+484,9,6,2,2,0x91,0,5,1,yes,0,0,0,misc,0	//HW_GRAVITATION#Gravity Field#
 485,-2,6,1,-1,0x8,0,10,1,no,0,0,0,weapon,0	//WS_CARTTERMINATION#Cart Termination#
 486,0,6,4,0,0x1,0,5,1,no,0,0,0,weapon,0	//WS_OVERTHRUSTMAX#Maximum Power Thrust#
 487,0,6,4,0,0x1,0,5,1,no,0,0,0,none,0	//CG_LONGINGFREEDOM#Longing for Freedom#

+ 23 - 43
src/map/battle.c

@@ -2155,9 +2155,6 @@ struct Damage battle_calc_magic_attack(
 			if(mflag) //mflag has a value when it was checked against an undead in skill.c [Skotlex]
 				ad.blewcount = 0; //No knockback
 			break;
-		case HW_GRAVITATION:
-			ad.dmotion = 0; //No flinch animation.
-			break;
 		case PR_SANCTUARY:
 			ad.dmotion = 0; //No flinch animation.
 			break;
@@ -2202,9 +2199,6 @@ struct Damage battle_calc_magic_attack(
 			case PF_SOULBURN:
 				ad.damage = tstatus->sp * 2;
 				break;
-			case HW_GRAVITATION:
-				ad.damage = 200+200*skill_lv;
-				break;
 			default:
 			{
 				if (skill_num == NPC_EARTHQUAKE) {
@@ -2556,6 +2550,10 @@ struct Damage  battle_calc_misc_attack(
 		md.damage = 500+rand()%500 + 5*skill_lv * sstatus->int_;
 		nk|=NK_IGNORE_FLEE|NK_NO_ELEFIX; //These two are not properties of the weapon based part.
 		break;
+	case HW_GRAVITATION:
+		md.damage = 200+200*skill_lv;
+		md.dmotion = 0; //No flinch animation.
+		break;
 	}
 
 	if (nk&NK_SPLASHSPLIT){ // Divide ATK among targets
@@ -2678,8 +2676,8 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
 	return d;
 }
 
-//Calculates returned damage. direct is true if the skill was a direct attack (that is, not from another source, like a land spell
-int battle_calc_return_damage(struct block_list* bl, int* damage, int direct, int flag)
+//Calculates BF_WEAPON returned damage.
+int battle_calc_return_damage(struct block_list* bl, int damage, int flag)
 {
 	struct map_session_data* sd = NULL;
 	struct status_change* sc;
@@ -2690,37 +2688,23 @@ int battle_calc_return_damage(struct block_list* bl, int* damage, int direct, in
 	if(sc && !sc->count)
 		sc = NULL;
 
-	if(flag&BF_WEAPON && direct) {
-		//Bounces back part of the damage.
-		if (flag & BF_SHORT) {
-			if (sd && sd->short_weapon_damage_return)
-			{
-				rdamage += *damage * sd->short_weapon_damage_return / 100;
-				if(rdamage < 1) rdamage = 1;
-			}
-			if (sc && sc->data[SC_REFLECTSHIELD].timer != -1)
-		  	{
-				rdamage += *damage * sc->data[SC_REFLECTSHIELD].val2 / 100;
-				if (rdamage < 1) rdamage = 1;
-			}
-		} else if (flag & BF_LONG) {
-			if (sd && sd->long_weapon_damage_return)
-			{
-				rdamage += *damage * sd->long_weapon_damage_return / 100;
-				if (rdamage < 1) rdamage = 1;
-			}
+	//Bounces back part of the damage.
+	if (flag & BF_SHORT) {
+		if (sd && sd->short_weapon_damage_return)
+		{
+			rdamage += damage * sd->short_weapon_damage_return / 100;
+			if(rdamage < 1) rdamage = 1;
 		}
-	} else
-	// magic_damage_return by [AppleGirl] and [Valaris]
-	if(flag&BF_MAGIC)
-	{
-		if(
-			(sd && sd->magic_damage_return && direct && rand()%100 < sd->magic_damage_return)
-			|| (sc && sc->data[SC_MAGICMIRROR].timer != -1 && rand()%100 < sc->data[SC_MAGICMIRROR].val2)
-			)
-		{	//Bounces back full damage, you take none.
-			rdamage = *damage;
-		 	*damage = 0;
+		if (sc && sc->data[SC_REFLECTSHIELD].timer != -1)
+		{
+			rdamage += damage * sc->data[SC_REFLECTSHIELD].val2 / 100;
+			if (rdamage < 1) rdamage = 1;
+		}
+	} else if (flag & BF_LONG) {
+		if (sd && sd->long_weapon_damage_return)
+		{
+			rdamage += damage * sd->long_weapon_damage_return / 100;
+			if (rdamage < 1) rdamage = 1;
 		}
 	}
 	return rdamage;
@@ -2909,7 +2893,7 @@ int battle_weapon_attack(struct block_list* src, struct block_list* target, unsi
 
 	damage = wd.damage + wd.damage2;
 	if (damage > 0 && src != target) {
-		rdamage = battle_calc_return_damage(target, &damage, 1, wd.flag);
+		rdamage = battle_calc_return_damage(target, damage, wd.flag);
 		if (rdamage > 0) {
 			rdelay = clif_damage(src, src, tick, wd.amotion, sstatus->dmotion, rdamage, 1, 4, 0);
 			//Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
@@ -3162,10 +3146,6 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 			if (!su->group)
 				return 0;
 
-			//For some mysterious reason ground-skills can't target homun.
-			if (target->type == BL_HOM && battle_config.hom_setting&0x2)
-				return 0;
-
 			if (su->group->src_id == target->id)
 			{
 				int inf2;

+ 1 - 1
src/map/battle.h

@@ -25,7 +25,7 @@ struct block_list;
 
 struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag);
 
-int battle_calc_return_damage(struct block_list *bl, int *damage, int direct, int flag);
+int battle_calc_return_damage(struct block_list *bl, int damage, int flag);
 
 void battle_drain(struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss);
 

+ 48 - 14
src/map/skill.c

@@ -1889,6 +1889,35 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in
 	return count; //Return amount of knocked back cells.
 }
 
+
+//Checks if there should be magic reflection. 
+//type is the type of magic attack: 0: indirect (aoe), 1: direct (targetted)
+static int skill_magic_reflect(struct block_list *src, struct block_list *target, int type)
+{
+	struct status_change *sc = status_get_sc(target);
+	struct map_session_data *sd;
+	BL_CAST(BL_PC, src, sd);
+
+	if(sd && sd->magic_damage_return && type && rand()%100 < sd->magic_damage_return)
+		return 1;
+
+	if(sc && sc->count)
+	{
+		if(sc->data[SC_MAGICMIRROR].timer != -1 && rand()%100 < sc->data[SC_MAGICMIRROR].val2)
+			return 1;
+
+		if(sc->data[SC_KAITE].timer != -1 && (sd || status_get_lv(src) <= 80))
+		{	//Works on players or mobs with level under 80.
+			clif_specialeffect(target, 438, AREA);
+			if (--sc->data[SC_KAITE].val2 <= 0)
+				status_change_end(target, SC_KAITE, -1);
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
 /*
  * =========================================================================
  * Does a skill attack with the given properties.
@@ -1964,16 +1993,15 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
 	}
 
 	if (attack_type&BF_MAGIC) {
-	 	if(sc && sc->data[SC_KAITE].timer != -1 && (dmg.damage || dmg.damage2)
-			&& !(sstatus->mode&MD_BOSS) && (sd || status_get_lv(src) <= 80) )
-		{	//Works on players or mobs with level under 80.
-			clif_specialeffect(bl, 438, AREA);
-			if (--sc->data[SC_KAITE].val2 <= 0)
-				status_change_end(bl, SC_KAITE, -1);
-			clif_skill_nodamage(bl,src,skillid,skilllv,1);
-			bl = src; //Just make the skill attack yourself @.@
+		if (!(sstatus->mode&MD_BOSS) && (dmg.damage || dmg.damage2) &&
+			skill_magic_reflect(src, bl, src==dsrc))
+		{	//Magic reflection, switch caster/target
+			struct block_list *tbl = bl;
+			bl = src;
+			src = tbl;
+			BL_CAST(BL_PC, src, sd);
+			BL_CAST(BL_PC, bl, tsd);
 			sc = status_get_sc(bl);
-			tsd = (bl->type == BL_PC)?(TBL_PC*)bl:NULL;
 			if (sc && !sc->count)
 				sc = NULL; //Don't need it.
 			//Spirit of Wizard blocks bounced back spells.
@@ -2016,8 +2044,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
 
 	damage = dmg.damage + dmg.damage2;
 
-	if (damage > 0 && src != bl && skillid != WS_CARTTERMINATION) // FIXME(?): Quick and dirty check, but HSCR does bypass Shield Reflect... so I make it bypass the whole reflect thing [DracoRPG]
-		rdamage = battle_calc_return_damage(bl, &damage, src == dsrc, dmg.flag);
+	if (damage > 0 && dmg.flag&BF_WEAPON && src != bl && src == dsrc &&
+		skillid != WS_CARTTERMINATION) // FIXME(?): Quick and dirty check, but HSCR does bypass Shield Reflect... so I make it bypass the whole reflect thing [DracoRPG]
+		rdamage = battle_calc_return_damage(bl, damage, dmg.flag);
 
 	//Skill hit type
 	type=(skillid==0)?5:skill_get_hit(skillid);
@@ -2775,8 +2804,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
 		return 1;
 
 	if (skillid && skill_get_type(skillid) == BF_MAGIC && status_isimmune(bl) == 100)
-	{	//GTB makes all targetted magic fail silently.
-		if (sd) clif_skill_fail(sd,skillid,0,0);
+	{	//GTB makes all targetted magic display miss with a single bolt.
+		clif_skill_damage(src, bl, tick, status_get_amotion(src), tstatus->dmotion,
+			0, 1, skillid, skilllv, skill_get_hit(skillid));
 		return 1;
 	}
 
@@ -4483,6 +4513,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 
 	case WZ_ESTIMATION:
 		if(sd) {
+			if (dstsd) {
+				clif_skill_fail(sd,skillid,0,0);
+				break;
+			}
 			clif_skill_nodamage(src,bl,skillid,skilllv,1);
 			clif_skill_estimation((struct map_session_data *)src,bl);
 		}
@@ -7545,7 +7579,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
 			break;
 
 		case UNT_GRAVITATION:
-			skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+			skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
 			break;
 
 		case UNT_DESPERADO: