Pārlūkot izejas kodu

- Should have fixed a signed/unsigned warning in login-txt
- Moved the class-change code from battle_calc_weapon_attack to skill_additional_effect.


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

skotlex 19 gadi atpakaļ
vecāks
revīzija
07e449bc5c
5 mainītis faili ar 33 papildinājumiem un 22 dzēšanām
  1. 3 0
      Changelog-Trunk.txt
  2. 3 1
      src/login/login.c
  3. 0 21
      src/map/battle.c
  4. 1 0
      src/map/itemdb.c
  5. 26 0
      src/map/skill.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/08/09
+	* Moved the class-change code from battle_calc_weapon_attack to
+	  skill_additional_effect. Alchemist summons now also have a chance of
+	  triggering polymorphing. [Skotlex]
 	* Removed the code which was auto-setting attacks that do no damage to type
 	  FLEE, since that was disabling status-effects which should incur even when
 	  the damage was blocked. [Skotlex]

+ 3 - 1
src/login/login.c

@@ -1911,7 +1911,8 @@ int parse_fromchar(int fd) {
 			}
 			{
 				struct online_login_data *p;
-				unsigned int aid, users;
+				int aid;
+			  	unsigned int users;
 				online_db->foreach(online_db,online_db_setoffline,id); //Set all chars from this char-server offline first
 				users = RFIFOW(fd,4);
 				for (i = 0; i < users; i++) {
@@ -1952,6 +1953,7 @@ int parse_fromchar(int fd) {
 				WFIFOSET(fd,WFIFOW(fd,2));
 			}
 			break;
+
 		case 0x2736: // WAN IP update from char-server
 			if (RFIFOREST(fd) < 6)
 				return 0;

+ 0 - 21
src/map/battle.c

@@ -2024,27 +2024,6 @@ static struct Damage battle_calc_weapon_attack(
 		}
 	}
 
-	if(sd && sd->classchange && target->type == BL_MOB && !(tstatus->mode&MD_BOSS) && (rand()%10000 < sd->classchange))
-	{
-		struct mob_data *tmd = (TBL_MOB*)target;
-		if (!tmd->guardian_data && (tmd->class_ < 1324 || tmd->class_ > 1363) && !mob_is_clone(tmd->class_))
-		{	//Classchange:
-			struct mob_db *mob;
-			int k, class_;
-			i = 0;
-			do {
-				do {
-					class_ = rand() % MAX_MOB_DB;
-				} while (!mobdb_checkid(class_));
-				
-				k = rand() % 1000000;
-				mob = mob_db(class_);
-			} while ((mob->status.mode&(MD_BOSS|MD_PLANT) || mob->summonper[0] <= k) && (i++) < 2000);
-			if (i< 2000)
-				mob_class_change(tmd,class_);
-		}
-	}
-	
 	if (wd.damage || wd.damage2) {
 		if (sd && battle_config.equip_self_break_rate)
 		{	// Self weapon breaking

+ 1 - 0
src/map/itemdb.c

@@ -111,6 +111,7 @@ int itemdb_searchrandomid(int group)
 		ShowError("itemdb_searchrandomid: No item entries for group id %d\n", group);
 	return UNKNOWN_ITEM_ID;
 }
+
 /*==========================================
  * Calculates total item-group related bonuses for the given item. [Skotlex]
  *------------------------------------------

+ 26 - 0
src/map/skill.c

@@ -1454,6 +1454,32 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
 			break; //Only one auto skill comes off at a time.
 		}
 	}
+
+	//Polymorph
+	if(sd && sd->classchange && attack_type&BF_WEAPON &&
+		dstmd && !(tstatus->mode&MD_BOSS) && !dstmd->guardian_data &&
+	  	(dstmd->class_ < 1324 || dstmd->class_ > 1363) && //Treasure boxes
+	  	!mob_is_clone(dstmd->class_) && 
+	  	(rand()%10000 < sd->classchange)) 
+	{
+		struct mob_db *mob;
+		int class_;
+		skill = 0;
+		do {
+			do {
+				class_ = rand() % MAX_MOB_DB;
+			} while (!mobdb_checkid(class_));
+			
+			rate = rand() % 1000000;
+			mob = mob_db(class_);
+		} while (
+			(mob->status.mode&(MD_BOSS|MD_PLANT) || mob->summonper[0] <= rate) &&
+		  	(skill++) < 2000);
+		if (skill < 2000)
+			mob_class_change(dstmd,class_);
+	}
+	
+
 	return 0;
 }