소스 검색

- Updated the autospell bonus scripts so you don't have to specify all the attack type criteria. If neither of BF_LONG/BF_SHORT is specified, the spell will trigger on both. If neither of BF_WEAPON/BF_MAGIC/BF_MISC is specified, the spell will trigger on BF_WEAPON, if neither of BF_NORMAL/BF_SKILL is specified, BF_SKILL is used if the trigger is BF_MAGIC/BF_MISC and BF_NORMAL is used if the attack is BF_WEAPON. This way the default when nothing is specified is BF_NORMAL|BF_WEAPON|BF_SHORT|BF_LONG.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10300 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 년 전
부모
커밋
e120c937cc
4개의 변경된 파일35개의 추가작업 그리고 15개의 파일을 삭제
  1. 9 0
      Changelog-Trunk.txt
  2. 14 10
      doc/item_bonus.txt
  3. 11 4
      src/map/pc.c
  4. 1 1
      src/map/script.c

+ 9 - 0
Changelog-Trunk.txt

@@ -3,6 +3,15 @@ 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/04/22
+	* Updated the autospell bonus scripts so you don't have to specify all the
+	  attack type criteria. If neither of BF_LONG/BF_SHORT is specified, the
+	  spell will trigger on both. If neither of BF_WEAPON/BF_MAGIC/BF_MISC is
+	  specified, the spell will trigger on BF_WEAPON, if neither of
+	  BF_NORMAL/BF_SKILL is specified, BF_SKILL is used if the trigger is
+	  BF_MAGIC/BF_MISC and BF_NORMAL is used if the attack is BF_WEAPON. This way
+	  the default when nothing is specified is
+	  BF_NORMAL|BF_WEAPON|BF_SHORT|BF_LONG. [Skotlex]
 2007/04/21
 	* Removed the +25% mdef, -50% def effect from Freeze status
 	* Changed autocast skills, they now only work with normal attacks!

+ 14 - 10
doc/item_bonus.txt

@@ -204,12 +204,20 @@ bonus5 bAutoSpell,x,y,n,t,i;		n/10% chance to cast skill x of level y when
                                         t: Trigger criteria:
                                            BF_SHORT: Trigger on melee attack
                                            BF_LONG: Trigger on ranged attack
+                                           (When neither is specified,
+                                           then BF_SHORT+BF_LONG is used.
                                            BF_WEAPON: Trigger on weapon skills 
                                            BF_MAGIC: Trigger on magic skills 
-                                           BF_MISC: Trigger on misc skills 
-                                           (the default for the other
-                                           bAutoSpell modes is
-                                           BF_WEAPON|BF_LONG|BF_SHORT)
+                                           BF_MISC: Trigger on misc skills
+														 (If none is specified, BF_WEAPON is
+                                           used)
+                                           BF_NORMAL: Trigger on normal
+                                           attacks. 
+                                           BF_SKILL: Trigger on skills
+                                           (When neither is specified,
+                                           BF_SKILL is used if the type is
+                                           BF_MISC or BF_MAGIC. BF_NORMAL is
+                                           used if the type is BF_WEAPON)
 
 bonus5 bAutoSpellWhenHit,x,y,n,t,i;	n/10% chance to cast skill x of level y when
                                         being hit by a direct attack. Target
@@ -218,12 +226,8 @@ bonus5 bAutoSpellWhenHit,x,y,n,t,i;	n/10% chance to cast skill x of level y when
                                         i: 1=cast on enemy, not on self
                                            2=use random skill lv in [1..y]
                                            3=1+2 (random lv on enemy)
-                                        t: Trigger criteria:
-                                           BF_SHORT: Trigger on melee attack
-                                           BF_LONG: Trigger on ranged attack
-                                           BF_WEAPON: Trigger on weapon skills 
-                                           BF_MAGIC: Trigger on magic skills 
-                                           BF_MISC: Trigger on misc skills 
+                                        t: Trigger criteria (see bonus5
+                                           bAutoSpell)
 
 //---- 2/22 new card effects ----
 

+ 11 - 4
src/map/pc.c

@@ -1260,6 +1260,13 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor
 	spell[i].id = id;
 	spell[i].lv = lv;
 	spell[i].rate = rate;
+	//Auto-update flag value.
+	if (!(flag&BF_RANGEMASK)) flag|=BF_SHORT|BF_LONG; //No range defined? Use both.
+	if (!(flag&BF_WEAPONMASK)) flag|=BF_WEAPON; //No attack type defined? Use weapon.
+	if (!(flag&BF_SKILLMASK)) {
+		if (flag&(BF_MAGIC|BF_MISC)) flag|=BF_SKILL; //These two would never trigger without BF_SKILL
+		if (flag&BF_WEAPON) flag|=BF_NORMAL; //By default autospells should only trigger on normal weapon attacks.
+	}
 	spell[i].flag|= flag;
 	spell[i].card_id = card_id;
 	return 1;
@@ -2329,11 +2336,11 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
 		break;
 	case SP_AUTOSPELL:
 		if(sd->state.lr_flag != 2)
-			pc_bonus_autospell(sd->autospell, MAX_PC_BONUS, type2, type3, val, BF_WEAPON|BF_SHORT|BF_LONG|BF_NORMAL, current_equip_card_id);
+			pc_bonus_autospell(sd->autospell, MAX_PC_BONUS, type2, type3, val, 0, current_equip_card_id);
 		break;
 	case SP_AUTOSPELL_WHENHIT:
 		if(sd->state.lr_flag != 2)
-			pc_bonus_autospell(sd->autospell2, MAX_PC_BONUS, type2, type3, val, BF_WEAPON|BF_SHORT|BF_LONG|BF_NORMAL, current_equip_card_id);
+			pc_bonus_autospell(sd->autospell2, MAX_PC_BONUS, type2, type3, val, 0, current_equip_card_id);
 		break;
 	case SP_HP_LOSS_RATE:
 		if(sd->state.lr_flag != 2) {
@@ -2422,12 +2429,12 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4
 	switch(type){
 	case SP_AUTOSPELL:
 		if(sd->state.lr_flag != 2)
-			pc_bonus_autospell(sd->autospell, MAX_PC_BONUS, (val&1?type2:-type2), (val&2?-type3:type3), type4, BF_WEAPON|BF_SHORT|BF_LONG|BF_NORMAL, current_equip_card_id);
+			pc_bonus_autospell(sd->autospell, MAX_PC_BONUS, (val&1?type2:-type2), (val&2?-type3:type3), type4, 0, current_equip_card_id);
 		break;
 
 	case SP_AUTOSPELL_WHENHIT:
 		if(sd->state.lr_flag != 2)
-			pc_bonus_autospell(sd->autospell2, MAX_PC_BONUS, (val&1?type2:-type2), (val&2?-type3:type3), type4, BF_WEAPON|BF_SHORT|BF_LONG|BF_NORMAL, current_equip_card_id);
+			pc_bonus_autospell(sd->autospell2, MAX_PC_BONUS, (val&1?type2:-type2), (val&2?-type3:type3), type4, 0, current_equip_card_id);
 		break;
 	default:
 		if(battle_config.error_log)

+ 1 - 1
src/map/script.c

@@ -6560,7 +6560,7 @@ BUILDIN_FUNC(statusup2)
 /// bonus2 <bonus type>,<val1>,<val2>
 /// bonus3 <bonus type>,<val1>,<val2>,<val3>
 /// bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>
-/// bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>
+/// bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>
 BUILDIN_FUNC(bonus)
 {
 	int type;