You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			85 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
		
		
			
		
	
	
			85 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
| 
											2 years ago
										 | using System.Collections.Generic; | ||
|  | using Articy.Touhou; | ||
|  | using Articy.Unity; | ||
|  | 
 | ||
|  | namespace Game | ||
|  | { | ||
|  |     public enum EBuffEffectTimingType | ||
|  |     { | ||
|  |         During, | ||
|  |         Enter, | ||
|  |         Leave, | ||
|  |         LevelUp, | ||
|  |         LevelDown, | ||
|  |         LevelFull, | ||
|  |         Attack, | ||
|  |         BeAttack, | ||
|  |         BeAttackHeavy, | ||
|  |     } | ||
|  | 
 | ||
|  |     public struct BuffEffectData | ||
|  |     { | ||
|  |         public GameEntity Entity; | ||
|  |         public GameEntity Target; | ||
|  |         public ArticyObject BuffObj; | ||
|  |     } | ||
|  | 
 | ||
|  |     public static partial class UtilBuff | ||
|  |     { | ||
|  |         public static void BuffEffectAll(int t, EBuffEffectTimingType timing) | ||
|  |         { | ||
|  |             var target = Util.GetEntity(t); | ||
|  |             var buff = target.buff; | ||
|  |             var temp = new List<BuffData>(buff.BuffMap.Value.Values); | ||
|  |             foreach (var buffItem in temp) | ||
|  |             { | ||
|  |                 BuffEffect(buffItem, timing); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         public static void SendHitBuff(int target, string buffId) | ||
|  |         { | ||
|  |             var buffCfg = Util.GetBuffConfig(buffId); | ||
|  |             var hitMsg = new PEntityHitText() | ||
|  |             { | ||
|  |                 Target = target, | ||
|  |                 Text = buffCfg.Buff.Name, | ||
|  |             }; | ||
|  |             EventManager.Instance.SendEvent(EEvent.EntityHitText, hitMsg); | ||
|  |         } | ||
|  | 
 | ||
|  |         public static void BuffEffect(BuffData data, EBuffEffectTimingType timing) | ||
|  |         { | ||
|  |             var entity = Util.GetEntity(data.Owner); | ||
|  |             var target = Util.GetEntity(data.Target); | ||
|  |             // Util.Print(data.buffCfg.Buff.Name, data.owner, data.target, timing); | ||
|  |             foreach (var item in data.BuffCfg.Buff.BuffEffect) | ||
|  |             { | ||
|  |                 var basicInfo = ((IObjectWithFeatureBuffEffect)item).GetFeatureBuffEffect(); | ||
|  |                 //检查owner的前置祝福 | ||
|  |                 if (basicInfo.Bless != null) | ||
|  |                 { | ||
|  |                     var preBless = (Bless)basicInfo.Bless; | ||
|  |                     if (!Util.HasBless(entity, preBless.TechnicalName)) | ||
|  |                     { | ||
|  |                         continue; | ||
|  |                     } | ||
|  |                 } | ||
|  | 
 | ||
|  |                 //检查timing | ||
|  |                 if ((EBuffEffectTimingType)basicInfo.BuffEffectTimingType != timing) | ||
|  |                 { | ||
|  |                     continue; | ||
|  |                 } | ||
|  | 
 | ||
|  |                 var buffData = new BuffEffectData | ||
|  |                 { | ||
|  |                     Entity = entity, | ||
|  |                     Target = target, | ||
|  |                     BuffObj = item, | ||
|  |                 }; | ||
|  |                 BuffEffect(data, buffData); | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | } |