public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness); decoy.AddToWorld(); neweffect.Start(decoy); }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness); neweffect.Start(target); if (target == null) { return; } if (!target.IsAlive || target.ObjectState != GameObject.eObjectState.Active) { return; } // spell damage should 25; int end = (int)Spell.Damage; target.ChangeEndurance(target, GameLiving.eEnduranceChangeType.Spell, -end); if (target is GamePlayer) { ((GamePlayer)target).Out.SendMessage($" You lose {end} endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); } (Caster as GamePlayer)?.Out.SendMessage($"{target.Name} loses {end} endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness); if (target == null) { return; } if (!target.IsAlive || target.ObjectState != GameObject.eObjectState.Active) { return; } neweffect.Start(target); int mana = (int)Spell.Damage; target.ChangeMana(target, GameLiving.eManaChangeType.Spell, -mana); if (target is GamePlayer) { ((GamePlayer)target).Out.SendMessage($"{Caster.Name} steals you {mana} points of power!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); } StealMana(target, mana); // target.StartInterruptTimer(SPELL_INTERRUPT_DURATION, AttackData.eAttackType.Spell, Caster); }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = GetPetBrain(Caster); m_pet = GetGamePet(template); //brain.WalkState = eWalkState.Stay; m_pet.SetOwnBrain(brain as AI.ABrain); int x, y, z; ushort heading; Region region; GetPetLocation(out x, out y, out z, out heading, out region); m_pet.X = x; m_pet.Y = y; m_pet.Z = z; m_pet.Heading = heading; m_pet.CurrentRegion = region; m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; m_pet.Level = GetPetLevel(); if (m_isSilent) { m_pet.IsSilent = true; } m_pet.AddToWorld(); //Check for buffs if (brain is ControlledNpcBrain) { (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); } AddHandlers(); SetBrainToOwner(brain); effect.Start(m_pet); Caster.OnPetSummoned(m_pet); }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { NpcTemplate template = NpcTemplateMgr.GetTemplate((int)m_spell.Value); base.ApplyEffectOnTarget(target, effectiveness); if (template.ClassType == "") { npc = new GameNPC(); } else { try { npc = new GameNPC(); npc = (GameNPC)Assembly.GetAssembly(typeof(GameServer)).CreateInstance(template.ClassType, false); } catch (Exception e) { } if (npc == null) { try { npc = (GameNPC)Assembly.GetExecutingAssembly().CreateInstance(template.ClassType, false); } catch (Exception e) { } } if (npc == null) { MessageToCaster("There was an error creating an instance of " + template.ClassType + "!", DOL.GS.PacketHandler.eChatType.CT_System); return; } npc.LoadTemplate(template); } GameSpellEffect effect = CreateSpellEffect(npc, effectiveness); int x, y; m_caster.GetSpotFromHeading(64, out x, out y); npc.X = x; npc.Y = y; npc.Z = m_caster.Z; npc.CurrentRegion = m_caster.CurrentRegion; npc.Heading = (ushort)((m_caster.Heading + 2048) % 4096); npc.Realm = m_caster.Realm; npc.CurrentSpeed = 0; npc.Level = 1; npc.SetOwnBrain(new AI.Brain.BlankBrain()); npc.AddToWorld(); effect.Start(npc); }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { if (!(Caster is GamePlayer player)) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.Warn($"NPC template {Spell.LifeDrainReturn} not found! Spell: {Spell}"); } MessageToCaster($"NPC template {Spell.LifeDrainReturn} not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); TitanBrain controlledBrain = new TitanBrain(player) { IsMainPet = false, WalkState = eWalkState.Stay }; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); // Suncheck: // Is needed, else it can cause error (i.e. /cast-command) if (x == 0 || y == 0) { CheckCastLocation(); } summoned.X = x; summoned.Y = y; summoned.Z = z; summoned.CurrentRegion = player.CurrentRegion; summoned.Heading = (ushort)((player.Heading + 2048) % 4096); summoned.Realm = player.Realm; summoned.CurrentSpeed = 0; summoned.Size = 10; summoned.Level = 100; summoned.Flags |= GameNPC.eFlags.PEACE; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Aggressive; effect.Start(summoned); m_growTimer = new RegionTimer(Caster, new RegionTimerCallback(TitanGrows), C_GROWTIMER); }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { // Template of the Illusionblade NPC INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.Warn($"NPC template {Spell.LifeDrainReturn} not found! Spell: {Spell}"); } MessageToCaster($"NPC template {(ushort) Spell.LifeDrainReturn} not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = GetPetBrain(Caster); m_pet = GetGamePet(template); m_pet.SetOwnBrain(brain as AI.ABrain); int x, y, z; ushort heading; Region region; GetPetLocation(out x, out y, out z, out heading, out region); m_pet.X = x; m_pet.Y = y; m_pet.Z = z; m_pet.Heading = heading; m_pet.CurrentRegion = region; // m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; m_pet.Race = 0; m_pet.Level = 44; // lowered in patch 1109b m_pet.AddToWorld(); // Check for buffs (brain as ControlledNpcBrain)?.CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); AddHandlers(); SetBrainToOwner(brain); m_pet.AutoSetStats(); effect.Start(m_pet); // Set pet infos & Brain }
/// <summary> /// Fire bolt /// </summary> /// <param name="target"></param> public override void FinishSpellCast(GameLiving target) { m_caster.Mana -= PowerCost(target); // endurance m_caster.Endurance -= 5; // messages GamePlayer caster = (GamePlayer)m_caster; if (Spell.InstrumentRequirement == 0) { if (SecondarySpell == null && PrimarySpell == null) { MessageToCaster("No spells were loaded into " + m_spell.Name + ".", eChatType.CT_Spell); } else { MessageToCaster("Your " + m_spell.Name + " is ready for use.", eChatType.CT_Spell); //StartSpell(target); // and action GameSpellEffect neweffect = CreateSpellEffect(target, 1); neweffect.Start(m_caster); SendEffectAnimation(m_caster, 0, false, 1); ((GamePlayer)m_caster).Out.SendWarlockChamberEffect((GamePlayer)m_caster); } foreach (GamePlayer player in m_caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE)) { if (player != m_caster) { player.MessageFromArea(m_caster, m_caster.GetName(0, true) + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } } //the quick cast is unallowed whenever you miss the spell //set the time when casting to can not quickcast during a minimum time if (m_caster is GamePlayer) { QuickCastEffect quickcast = m_caster.EffectList.GetOfType <QuickCastEffect>(); if (quickcast != null && Spell.CastTime > 0) { m_caster.TempProperties.setProperty(GamePlayer.QUICK_CAST_CHANGE_TICK, m_caster.CurrentRegion.Time); m_caster.DisableSkill(SkillBase.GetAbility(Abilities.Quickcast), QuickCastAbilityHandler.DISABLE_DURATION); quickcast.Cancel(false); } } }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GamePlayer player = Caster as GamePlayer; if (player == null) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } Point2D summonloc; beffect = CreateSpellEffect(target, effectiveness); { summonloc = target.GetPointFromHeading(target.Heading, 64); BrittleBrain controlledBrain = new BrittleBrain(player); controlledBrain.IsMainPet = false; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); summoned.X = summonloc.X; summoned.Y = summonloc.Y; summoned.Z = target.Z; summoned.CurrentRegion = target.CurrentRegion; summoned.Heading = (ushort)((target.Heading + 2048) % 4096); summoned.Realm = target.Realm; summoned.CurrentSpeed = 0; summoned.Level = 1; summoned.Size = 10; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Passive; GameEventMgr.AddHandler(summoned, GameLivingEvent.Dying, new DOLEventHandler(GuardDie)); beffect.Start(Caster); } }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { //Template of the Illusionblade NPC INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + (ushort)Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = GetPetBrain(Caster); m_pet = GetGamePet(template); m_pet.SetOwnBrain(brain as AI.ABrain); Vector3 pos; ushort heading; Region region; GetPetLocation(out pos, out heading, out region); m_pet.Position = pos; m_pet.Heading = heading; m_pet.CurrentRegion = region; // m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; m_pet.Race = 0; m_pet.Level = 44; // lowered in patch 1109b, also calls AutoSetStats() m_pet.AddToWorld(); //Check for buffs if (brain is ControlledNpcBrain) { (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); } AddHandlers(); SetBrainToOwner(brain); effect.Start(m_pet); //Set pet infos & Brain }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness); if (target == null) { return; } if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) { return; } neweffect.Start(target); if (target is GamePlayer) { ((GamePlayer)target).Out.SendMessage("You're harder to hit!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); } }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { if (!(Caster is GamePlayer player)) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.Warn($"NPC template {Spell.LifeDrainReturn} not found! Spell: {Spell}"); } MessageToCaster($"NPC template {Spell.LifeDrainReturn} not found!", eChatType.CT_System); return; } beffect = CreateSpellEffect(target, effectiveness); { var summonloc = target.GetPointFromHeading(target.Heading, 64); BrittleBrain controlledBrain = new BrittleBrain(player); controlledBrain.IsMainPet = false; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); summoned.X = summonloc.X; summoned.Y = summonloc.Y; summoned.Z = target.Z; summoned.CurrentRegion = target.CurrentRegion; summoned.Heading = (ushort)((target.Heading + 2048) % 4096); summoned.Realm = target.Realm; summoned.CurrentSpeed = 0; summoned.Level = Caster.Level; summoned.Size = 50; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Passive; beffect.Start(Caster); } }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness); if (target == null) { return; } if (!target.IsAlive || target.ObjectState != GameObject.eObjectState.Active) { return; } neweffect.Start(target); if (target is GamePlayer player) { player.Out.SendMessage("Your strenght and constitution decreased!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); } }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GamePlayer player = Caster as GamePlayer; if (player == null) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } beffect = CreateSpellEffect(target, effectiveness); var summonloc = GameMath.GetPointFromHeading(target, 64); BrittleBrain controlledBrain = new BrittleBrain(player); controlledBrain.IsMainPet = false; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); summoned.Position = new Vector3(summonloc, target.Position.Z); summoned.CurrentRegion = target.CurrentRegion; summoned.Heading = (ushort)((target.Heading + 2048) % 4096); summoned.Realm = target.Realm; summoned.CurrentSpeed = 0; summoned.Level = Caster.Level; summoned.Size = 50; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Passive; beffect.Start(Caster); }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness); if (target == null) { return; } if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) { return; } neweffect.Start(target); // calc damage AttackData ad = CalculateDamageToTarget(target, effectiveness); DamageTarget(ad, true); SendDamageMessages(ad); target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster); }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = null; if (template.ClassType != null && template.ClassType.Length > 0) { Assembly asm = Assembly.GetExecutingAssembly(); brain = (IControlledBrain)asm.CreateInstance(template.ClassType, true); if (brain == null && log.IsWarnEnabled) { log.Warn($"ApplyEffectOnTarget(): ClassType {template.ClassType} on NPCTemplateID {template.TemplateId} not found, using default ControlledBrain"); } } if (brain == null) { brain = GetPetBrain(Caster); } m_pet = GetGamePet(template); //brain.WalkState = eWalkState.Stay; m_pet.SetOwnBrain(brain as AI.ABrain); m_pet.SummonSpellDamage = Spell.Damage; m_pet.SummonSpellValue = Spell.Value; int x, y, z; ushort heading; Region region; GetPetLocation(out x, out y, out z, out heading, out region); m_pet.X = x; m_pet.Y = y; m_pet.Z = z; m_pet.Heading = heading; m_pet.CurrentRegion = region; m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; if (m_isSilent) { m_pet.IsSilent = true; } m_pet.AddToWorld(); //Check for buffs if (brain is ControlledNpcBrain) { (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); } AddHandlers(); SetBrainToOwner(brain); m_pet.SetPetLevel(); m_pet.Health = m_pet.MaxHealth; if (DOL.GS.ServerProperties.Properties.PET_SCALE_SPELL_MAX_LEVEL > 0) { m_pet.Spells = template.Spells; // Have to scale spells again now that the pet level has been assigned } effect.Start(m_pet); Caster.OnPetSummoned(m_pet); }