public static void AD_SkillCasted(ActionDisplay actionDisplay, IMap map, Entity source, Entity target) { var drawableMap = map as IDrawableMap; // Play the sound PlaySoundSimple(actionDisplay, source); // Check if we can properly display the effect if (drawableMap != null && source != null) { if (actionDisplay.GrhIndex != GrhIndex.Invalid) { if (target != null && target != source) { // Show the graphic going from the source to target var gd = GrhInfo.GetData(actionDisplay.GrhIndex); if (gd != null) { var grh = new Grh(gd, AnimType.Loop, TickCount.Now); var effect = new MapGrhEffectSeekPosition(grh, source.Center, target.Center, 750f) { MapRenderLayer = MapRenderLayer.SpriteForeground }; drawableMap.AddTemporaryMapEffect(effect); } } else { // Show the graphic at the source var gd = GrhInfo.GetData(actionDisplay.GrhIndex); if (gd != null) { var grh = new Grh(gd, AnimType.Loop, TickCount.Now); var effect = new MapGrhEffectLoopOnce(grh, source.Center) { MapRenderLayer = MapRenderLayer.SpriteForeground }; drawableMap.AddTemporaryMapEffect(effect); } } } // Show the particle effect var pe = ParticleEffectManager.Instance.TryCreateEffect(actionDisplay.ParticleEffect); if (pe != null) { pe.Position = source.Center; ITemporaryMapEffect effect; if (target != null && target != source) { // Effect that seeks out the position of the target effect = new TemporaryMapParticleEffectSeekPosition(pe, target.Center, 250f) { MapRenderLayer = MapRenderLayer.SpriteForeground }; } else { // Effect that takes place at the source effect = new TemporaryMapParticleEffect(pe) { MapRenderLayer = MapRenderLayer.SpriteForeground }; } // Add the effect to the map if (effect != null) drawableMap.AddTemporaryMapEffect(effect); } } }
public static void AD_Projectile(ActionDisplay actionDisplay, IMap map, Entity source, Entity target) { var drawableMap = map as IDrawableMap; var sourceAsCharacter = source as Character; // Play the sound PlaySoundSimple(actionDisplay, source); // Show the attack animation on the attacker if (sourceAsCharacter != null) sourceAsCharacter.Attack(); // Check if we can properly display the effect if (drawableMap != null && target != null && source != target) { // Show the graphic going from the attacker to attacked if (actionDisplay.GrhIndex != GrhIndex.Invalid) { var gd = GrhInfo.GetData(actionDisplay.GrhIndex); if (gd != null) { var grh = new Grh(gd, AnimType.Loop, TickCount.Now); var effect = new MapGrhEffectSeekPosition(grh, source.Center, target.Center, 750f) { MapRenderLayer = MapRenderLayer.SpriteForeground }; drawableMap.AddTemporaryMapEffect(effect); } } // Show the particle effect var pe = ParticleEffectManager.Instance.TryCreateEffect(actionDisplay.ParticleEffect); if (pe != null) { // Effect that just takes place on the target and dies very quickly pe.Position = target.Center; pe.Life = 100; var effect = new TemporaryMapParticleEffect(pe) { MapRenderLayer = MapRenderLayer.SpriteForeground }; drawableMap.AddTemporaryMapEffect(effect); } } }