protected override void HandleMonsters(Character p_sorcerer, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     m_previouslySelectedMonster = LegacyLogic.Instance.WorldManager.Party.SelectedMonster;
     base.HandleMonsters(p_sorcerer, p_result, p_targets, p_magicFactor);
     LegacyLogic.Instance.WorldManager.Party.SelectMonsterWithoutEvent(m_previouslySelectedMonster);
     m_previouslySelectedMonster = null;
 }
Beispiel #2
0
        protected override Boolean IsApplySpellEventForMe(Object p_sender, EventArgs p_args, out String out_buffNameKey, out String out_spellNameKey)
        {
            out_buffNameKey  = null;
            out_spellNameKey = null;
            if (p_args is SpellEventArgs)
            {
                SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;
                foreach (MonsterBuffTarget monsterBuffTarget in spellEventArgs.SpellTargetsOfType <MonsterBuffTarget>())
                {
                    if (monsterBuffTarget.Target == MyController && monsterBuffTarget.Buff != EMonsterBuffType.NONE && ((Monster)monsterBuffTarget.Target).BuffHandler.HasBuff(monsterBuffTarget.Buff))
                    {
                        out_buffNameKey  = monsterBuffTarget.Buff.ToString();
                        out_spellNameKey = GetSpellNameKey(spellEventArgs.Spell);
                        return(true);
                    }
                }
                return(false);
            }
            ItemSuffixApplyBuffEventArgs itemSuffixApplyBuffEventArgs = (ItemSuffixApplyBuffEventArgs)p_args;

            if (itemSuffixApplyBuffEventArgs.TargetMonster == MyController && itemSuffixApplyBuffEventArgs.Buff != EMonsterBuffType.NONE)
            {
                out_buffNameKey  = itemSuffixApplyBuffEventArgs.Buff.ToString();
                out_spellNameKey = itemSuffixApplyBuffEventArgs.SuffixKey;
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
        {
            GridSlot             slot     = LegacyLogic.Instance.MapLoader.Grid.GetSlot(p_monster.Position);
            IList <MovingEntity> entities = slot.Entities;

            for (Int32 i = 0; i < entities.Count; i++)
            {
                if (entities[i] is Monster)
                {
                    Monster            monster  = (Monster)entities[i];
                    List <MonsterBuff> buffList = monster.BuffHandler.BuffList;
                    if (buffList != null && buffList.Count != 0)
                    {
                        List <MonsterBuff> list = new List <MonsterBuff>();
                        for (Int32 j = 0; j < buffList.Count; j++)
                        {
                            if (buffList[j].IsDebuff && (buffList[j].StaticID != 3 || monster != p_monster))
                            {
                                list.Add(buffList[j]);
                            }
                        }
                        if (list.Count > 0)
                        {
                            Int32 index = Random.Range(0, list.Count);
                            monster.BuffHandler.RemoveBuff(list[index]);
                        }
                    }
                }
            }
        }
        public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
        {
            m_grid = LegacyLogic.Instance.MapLoader.Grid;
            Party    party    = LegacyLogic.Instance.WorldManager.Party;
            GridSlot gridSlot = CheckSlot(party.Position);

            if (gridSlot == null)
            {
                gridSlot = FindTargetSlot(p_monster.Position);
            }
            if (gridSlot != null)
            {
                if (gridSlot.Position != party.Position)
                {
                    MoveParty(gridSlot);
                }
                SpawnCagePiece(gridSlot.Position + EDirection.WEST, true);
                SpawnCagePiece(gridSlot.Position + EDirection.NORTH, false);
                SpawnCagePiece(gridSlot.Position + EDirection.EAST, false);
                SpawnCagePiece(gridSlot.Position + EDirection.SOUTH, false);
            }
            else
            {
                LegacyLogger.Log("FOUND no slot :(");
            }
        }
		protected override void HandleMonsterBuffs(Character p_sorcerer, SpellEventArgs p_result, Monster p_target, Single p_magicFactor)
		{
			if (!p_target.AbilityHandler.HasAbility(EMonsterAbilityType.LARGE))
			{
				base.HandleMonsterBuffs(p_sorcerer, p_result, p_target, p_magicFactor);
			}
		}
 protected override void HandleMonsters(Character p_sorcerer, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     if (m_didHit)
     {
         for (Int32 i = 0; i < p_targets.Count; i++)
         {
             Monster monster = p_targets[i] as Monster;
             if (monster.CurrentHealth > 0 && m_staticData.MonsterBuffs != null)
             {
                 for (Int32 j = 0; j < m_staticData.MonsterBuffs.Length; j++)
                 {
                     if (m_staticData.MonsterBuffs[j] != EMonsterBuffType.NONE)
                     {
                         AddMonsterBuff(monster, m_staticData.MonsterBuffs[j], p_magicFactor);
                         Boolean p_Successful = monster.BuffHandler.HasBuff(m_staticData.MonsterBuffs[j]);
                         Boolean p_IsImmune   = false;
                         if (!monster.AbilityHandler.CanAddBuff(m_staticData.MonsterBuffs[j]))
                         {
                             p_IsImmune = true;
                         }
                         p_result.SpellTargets.Add(new MonsterBuffTarget(monster, m_staticData.MonsterBuffs[j], p_Successful, p_IsImmune));
                     }
                 }
             }
         }
     }
 }
 public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
 {
     if (Random.Value < m_staticData.GetAdditionalValue(m_level))
     {
         base.DoEffect(p_monster, p_target, p_spellArgs);
     }
 }
Beispiel #8
0
 protected virtual void HandleConditions(SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     if (m_staticData.RemovedConditions != null && m_staticData.RemovedConditions.Length != 0)
     {
         for (Int32 i = 0; i < m_staticData.RemovedConditions.Length; i++)
         {
             ECondition econdition = m_staticData.RemovedConditions[i];
             if (econdition != ECondition.NONE)
             {
                 for (Int32 j = 0; j < p_targets.Count; j++)
                 {
                     Character character = p_targets[j] as Character;
                     if (character != null)
                     {
                         if (character.ConditionHandler.HasCondition(econdition))
                         {
                             p_result.SpellTargets.Add(new RemovedConditionTarget(p_targets[j], econdition));
                             RemoveCondition(p_targets[j], econdition);
                             m_didPushEntry = true;
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #9
0
        protected void Drag(Monster p_monster, SpellEventArgs p_result)
        {
            if (p_monster.CurrentHealth <= 0)
            {
                return;
            }
            if (p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.LARGE) || p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.BOSS) || p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.STATIC_OBJECT))
            {
                return;
            }
            Party      party     = LegacyLogic.Instance.WorldManager.Party;
            Grid       grid      = LegacyLogic.Instance.MapLoader.Grid;
            EDirection direction = EDirectionFunctions.GetDirection(p_monster.Position, party.Position);
            Int32      num       = (Int32)Position.Distance(p_monster.Position, party.Position) - 1;

            for (Int32 i = 0; i < num; i++)
            {
                if (!grid.CanMoveEntity(p_monster, direction))
                {
                    break;
                }
                Position p_pos = p_monster.Position + direction;
                GridSlot slot  = grid.GetSlot(p_monster.Position);
                if (grid.GetSlot(p_pos).AddEntity(p_monster))
                {
                    slot.RemoveEntity(p_monster);
                }
            }
            if (Position.Distance(p_monster.Position, party.Position) > 1f)
            {
                LegacyLogic.Instance.WorldManager.Party.SelectedMonster = null;
            }
        }
Beispiel #10
0
        protected override void HandlePartyMemberHealing(Single p_magicFactor, Single p_critChance, Int32 p_critHealValue, SpellEventArgs p_result, List <Object> p_targets)
        {
            SpellEventArgs eventArgs = GetEventArgs();

            if (m_staticData.Damage != null && m_staticData.Damage.Length > 0 && m_staticData.Damage[0].Type == EDamageType.HEAL)
            {
                Int32 value = Damage.Create(m_staticData.Damage[0] * p_magicFactor, 0f).Value;
                for (Int32 i = 0; i < LegacyLogic.Instance.WorldManager.Party.Members.Length; i++)
                {
                    Character character = LegacyLogic.Instance.WorldManager.Party.Members[i];
                    if (character.HealthPoints < character.MaximumHealthPoints)
                    {
                        Boolean flag = Random.Range(0f, 1f) < p_critChance;
                        Int32   num  = value;
                        if (flag)
                        {
                            num = p_critHealValue;
                        }
                        eventArgs.SpellTargets.Add(new HealedTarget(character, num, flag));
                        character.ChangeHP(num);
                        DamageEventArgs p_eventArgs = new DamageEventArgs(new AttackResult
                        {
                            Result        = EResultType.HEAL,
                            DamageResults =
                            {
                                new DamageResult(EDamageType.HEAL, num, 0, 1f)
                            }
                        });
                        LegacyLogic.Instance.EventManager.InvokeEvent(character, EEventType.CHARACTER_HEALS, p_eventArgs);
                    }
                }
            }
            eventArgs.Result = ESpellResult.OK;
            LegacyLogic.Instance.ActionLog.PushEntry(new SpellEffectEntryEventArgs(null, eventArgs));
        }
Beispiel #11
0
 public static void InvokeSpellFinished(SpellEventArgs args)
 {
     if (SpellFinished != null)
     {
         SpellFinished(args);
     }
 }
 protected override void HandleMonsters(Character p_attacker, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     foreach (Monster monster in LegacyLogic.Instance.WorldManager.GetObjectsByTypeIterator <Monster>())
     {
         monster.BuffHandler.RemoveBuffByID(19);
     }
     base.HandleMonsters(p_attacker, p_result, p_targets, p_magicFactor);
 }
 public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
 {
     if (p_monster != null && !p_monster.BuffHandler.HasBuff(EMonsterBuffType.FLICKERING_LIGHT))
     {
         p_monster.AddBuff(BuffFactory.CreateMonsterBuff(EMonsterBuffType.FLICKERING_LIGHT, p_monster.MagicPower, m_level));
         m_cooldown = 3;
     }
 }
 protected override void HandleMonsters(Character p_attacker, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     if (p_targets.Count > 0)
     {
         ((Monster)p_targets[0]).BuffHandler.RemoveAllBuffs();
         p_result.SpellTargets.Add(new SpellTarget((Monster)p_targets[0]));
     }
 }
Beispiel #15
0
        private static void OnSpellEvent(SpellEventArgs args)
        {
            try
            {
                int     eoc   = 0;
                Spell   spell = args.Spell;
                Spell[] recentSpells;

                if (spellCache.ContainsKey(args.Player) == false)
                {
                    recentSpells    = new Spell[3];
                    recentSpells[0] = spell;
                    recentSpells[1] = spell;
                    recentSpells[2] = spell;
                    spellCache.Add(args.Player, recentSpells);

                    if (spell is MagerySpell)
                    {
                        eoc = (1 * ((int)((MagerySpell)spell).Circle + 1));
                    }

                    args.Player.EssenceOfCharacter += eoc;
                }

                else
                {
                    recentSpells = spellCache[args.Player];

                    bool recentSpell =
                        (recentSpells[0].ToString() == spell.ToString() ||
                         recentSpells[1].ToString() == spell.ToString() ||
                         recentSpells[2].ToString() == spell.ToString());

                    if (!recentSpell)
                    {
                        if (recentSpells[1] != null)
                        {
                            recentSpells[2] = recentSpells[1];
                        }
                        if (recentSpells[0] != null)
                        {
                            recentSpells[1] = recentSpells[0];
                        }

                        recentSpells[0] = spell;

                        if (spell is MagerySpell)
                        {
                            eoc = (1 * ((int)((MagerySpell)spell).Circle + 1));
                        }

                        args.Player.EssenceOfCharacter += eoc;
                    }
                }
            }

            catch { }
        }
Beispiel #16
0
 private void HandlePartyBuffs(SpellEventArgs p_result, Single p_magicFactor)
 {
     if (m_staticData.PartyBuff != EPartyBuffs.NONE)
     {
         p_result.AddedPartyBuffs = m_staticData.PartyBuff;
         p_result.SpellTargets.Add(new PartyBuffTarget(LegacyLogic.Instance.WorldManager.Party, m_staticData.PartyBuff));
         AddPartyBuff(p_magicFactor);
     }
 }
        public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
        {
            Grid       grid      = LegacyLogic.Instance.MapLoader.Grid;
            Position   position  = LegacyLogic.Instance.WorldManager.Party.Position;
            Int32      num       = 0;
            EDirection direction = EDirectionFunctions.GetDirection(position, p_monster.Position);
            Position   position2 = p_monster.Position + direction;
            GridSlot   slot      = grid.GetSlot(position2);

            while (slot != null && slot.IsPassable(p_monster, false) && num < 4)
            {
                num++;
                position2 += direction;
                slot       = grid.GetSlot(position2);
            }
            Int32      num2       = 0;
            EDirection direction2 = EDirectionFunctions.GetDirection(p_monster.Position, position);

            position2 = position + direction2;
            slot      = grid.GetSlot(position2);
            while (slot != null && slot.IsPassable(p_monster, false) && num2 < 3)
            {
                num2++;
                position2 += direction2;
                slot       = grid.GetSlot(position2);
            }
            if (num2 > 0)
            {
                num2++;
            }
            Position position3 = p_monster.Position;

            if (num2 > num)
            {
                for (Int32 i = 0; i < num2; i++)
                {
                    position3 += direction2;
                }
            }
            else
            {
                for (Int32 i = 0; i < num; i++)
                {
                    position3 += direction;
                }
            }
            Position position4 = p_monster.Position;

            grid.GetSlot(p_monster.Position).RemoveEntity(p_monster);
            grid.GetSlot(position3).AddEntity(p_monster);
            p_monster.Position  = position3;
            p_monster.Direction = EDirectionFunctions.GetDirection(p_monster.Position, position);
            BaseObjectEventArgs p_eventArgs = new BaseObjectEventArgs(p_monster, p_monster.Position);

            LegacyLogic.Instance.EventManager.InvokeEvent(p_monster, EEventType.SET_ENTITY_POSITION, p_eventArgs);
        }
Beispiel #18
0
 public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
 {
     if (Random.Value < m_staticData.GetAdditionalValue(m_level))
     {
         for (Int32 i = 0; i < m_staticData.InflictedConditions.Length; i++)
         {
             p_target.ConditionHandler.AddCondition(m_staticData.InflictedConditions[i]);
         }
     }
 }
        public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
        {
            Party party = LegacyLogic.Instance.WorldManager.Party;

            if (party.Buffs.Buffs.Count > 0)
            {
                List <PartyBuff> buffs = party.Buffs.Buffs;
                Int32            index = Random.Range(0, buffs.Count - 1);
                party.Buffs.RemoveBuff(buffs[index].Type);
            }
        }
 protected override void HandleMonsters(Character p_sorcerer, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     foreach (Object obj in p_targets)
     {
         Monster monster = (Monster)obj;
         if (monster != null)
         {
             ExecuteRangedAttackOnTarget(monster, p_sorcerer);
         }
     }
 }
Beispiel #21
0
 public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
 {
     if (p_target.FightHandler.CurrentGeneralBlockAttempts > 0)
     {
         p_target.FightHandler.CurrentGeneralBlockAttempts--;
     }
     else if (p_target.FightHandler.CurrentMeleeBlockAttempts > 0)
     {
         p_target.FightHandler.CurrentMeleeBlockAttempts--;
     }
 }
Beispiel #22
0
        public virtual Boolean CastSpell(Character p_sorcerer, Boolean p_fromScroll, Int32 p_scrollTier, List <Object> p_targets)
        {
            SpellEventArgs eventArgs = GetEventArgs();

            eventArgs.DamageType = ESkillIDToEDamageType(m_staticData.SkillID);
            m_didPushEntry       = false;
            m_fromScroll         = p_fromScroll;
            Single magicFactor = GetMagicFactor(p_sorcerer, p_fromScroll, p_scrollTier);

            if (m_staticData.SkillID == ESkillID.SKILL_WARFARE)
            {
                p_sorcerer.BarkHandler.TriggerBark(EBarks.ABILITY, p_sorcerer);
            }
            if (m_staticData.Damage != null && (m_staticData.Damage.Length == 0 || m_staticData.Damage[0].Maximum == 0 || m_staticData.Damage[0].Type == EDamageType.HEAL))
            {
                eventArgs.Result = ESpellResult.OK;
                if (m_staticData.RemovedConditions.Length == 0 || m_staticData.RemovedConditions[0] == ECondition.NONE)
                {
                    p_sorcerer.FightHandler.FeedActionLog(new CastSpellEntryEventArgs(p_sorcerer, eventArgs));
                    m_didPushEntry = true;
                }
            }
            HandleConditions(eventArgs, p_targets, magicFactor);
            HandlePartyBuffs(eventArgs, magicFactor);
            HandleMonsters(p_sorcerer, eventArgs, p_targets, magicFactor);
            if (m_staticData.Damage != null && m_staticData.Damage.Length > 0 && m_staticData.Damage[0].Type == EDamageType.HEAL)
            {
                Int32  value                  = Damage.Create(m_staticData.Damage[0] * magicFactor, 0f).Value;
                Int32  p_critHealValue        = (Int32)(value * p_sorcerer.FightValues.MagicalCriticalDamageMod);
                Single criticalMagicHitChance = p_sorcerer.FightValues.CriticalMagicHitChance;
                HandlePartyMemberHealing(magicFactor, criticalMagicHitChance, p_critHealValue, eventArgs, p_targets);
            }
            else if (SpellType == ECharacterSpell.SPELL_LIGHT_LAY_ON_HANDS)
            {
                HandlePartyMemberHealing(magicFactor, 0f, 0, eventArgs, p_targets);
            }
            HandlePartyCharacters(p_sorcerer, eventArgs, p_targets, magicFactor);
            if (!p_fromScroll && SpellType != ECharacterSpell.SPELL_PRIME_IDENTIFY)
            {
                UseResources(p_sorcerer);
            }
            eventArgs.Result = ESpellResult.OK;
            if (m_staticData.SkillID != ESkillID.SKILL_WARFARE)
            {
                p_sorcerer.BarkHandler.TriggerBark(EBarks.SPELL, p_sorcerer);
            }
            p_sorcerer.CastSpellEvent(this, eventArgs);
            if (!m_didPushEntry)
            {
                p_sorcerer.FightHandler.FeedActionLog(new CastSpellEntryEventArgs(p_sorcerer, eventArgs));
            }
            p_sorcerer.FightHandler.FlushActionLog();
            return(true);
        }
Beispiel #23
0
		protected override void HandlePartyCharacters(Character p_sorcerer, SpellEventArgs p_result, List<Object> p_targets, Single p_magicFactor)
		{
			base.HandlePartyCharacters(p_sorcerer, p_result, p_targets, p_magicFactor);
			foreach (Object obj in p_targets)
			{
				if (obj is Character)
				{
					p_result.SpellTargets.Add(new SpellTarget(obj));
				}
			}
		}
Beispiel #24
0
 protected override void HandlePartyCharacters(Character p_caster, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     for (Int32 i = 0; i < p_targets.Count; i++)
     {
         Character character = p_targets[i] as Character;
         if (character != null)
         {
             character.FightHandler.InterceptingCharacter = p_caster;
         }
     }
 }
Beispiel #25
0
 protected virtual void HandleMonsters(Character p_sorcerer, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor)
 {
     for (Int32 i = 0; i < p_targets.Count; i++)
     {
         Monster monster = p_targets[i] as Monster;
         if (monster != null)
         {
             if (monster.IsAttackable)
             {
                 if (m_staticData.SkillID == ESkillID.SKILL_WARFARE)
                 {
                     if (m_staticData.TargetType == ETargetType.SINGLE_MONSTER || m_staticData.TargetType == ETargetType.ALL_ADJACENT_MONSTERS)
                     {
                         List <AttackResult> list = MeleeAttackMonster(p_sorcerer, monster);
                         if (list == null)
                         {
                             goto IL_144;
                         }
                         if (list.Count == 0)
                         {
                             monster.HitAnimationDone.Trigger();
                         }
                         Boolean flag = false;
                         foreach (AttackResult attackResult in list)
                         {
                             if (attackResult.Result != EResultType.EVADE && attackResult.Result != EResultType.BLOCK)
                             {
                                 flag = true;
                                 break;
                             }
                         }
                         if (!flag)
                         {
                             goto IL_144;
                         }
                     }
                 }
                 else
                 {
                     AttackResult attackResult2 = DoAttackMonster(p_sorcerer, monster, p_magicFactor);
                     p_result.SpellTargets.Add(new AttackedTarget(monster, attackResult2));
                     if (attackResult2.Result == EResultType.EVADE || attackResult2.Result == EResultType.IMMUNE)
                     {
                         goto IL_144;
                     }
                     monster.ApplyDamages(attackResult2, p_sorcerer);
                 }
             }
             HandleMonsterBuffs(p_sorcerer, p_result, monster, p_magicFactor);
         }
         IL_144 :;
     }
 }
Beispiel #26
0
        private void OnMonsterCastSpell(Object p_sender, EventArgs p_args)
        {
            SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;

            foreach (AttackedTarget attackedTarget in spellEventArgs.SpellTargetsOfType <AttackedTarget>())
            {
                if (attackedTarget.Target == m_character && attackedTarget.Result != null)
                {
                    ShowDamageTextAndAnimationAndPlaySound(attackedTarget.Result, false, false, spellEventArgs.DamageType != EDamageType.PHYSICAL);
                }
            }
        }
Beispiel #27
0
        private void OnMonsterCastSpell(Object p_sender, EventArgs p_args)
        {
            SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;

            foreach (AttackedTarget attackedTarget in spellEventArgs.SpellTargetsOfType <AttackedTarget>())
            {
                if (spellEventArgs.Spell.NameKey != "MONSTER_SPELL_LIQUID_MEMBRANE")
                {
                    ShowHitEffect((Monster)p_sender);
                }
            }
        }
Beispiel #28
0
        public override void DoEffect(Monster p_monster, Character p_target, SpellEventArgs p_spellArgs)
        {
            Grid     grid     = LegacyLogic.Instance.MapLoader.Grid;
            Position position = p_monster.Position;
            GridSlot slot     = grid.GetSlot(position);
            Int32    num;

            if (LegacyLogic.Instance.WorldManager.Party.InCombat)
            {
                num = Random.Range(0, 4);
            }
            else
            {
                List <GridSlot> list = new List <GridSlot>();
                for (Int32 i = 0; i < 4; i++)
                {
                    GridSlot slot2 = grid.GetSlot(position + (EDirection)i);
                    if (slot2 != null && p_monster.CanPassTerrain(slot2.TerrainType))
                    {
                        list.Add(slot2);
                    }
                }
                list.Sort((GridSlot a, GridSlot b) => Position.Distance(a.Position, LegacyLogic.Instance.WorldManager.Party.Position).CompareTo(Position.Distance(b.Position, LegacyLogic.Instance.WorldManager.Party.Position)));
                num = (Int32)EDirectionFunctions.GetDirection(position, list[0].Position);
            }
            EDirection p_dir = (EDirection)num;

            if (grid.AddMovingEntity(position + p_dir, p_monster))
            {
                slot.RemoveEntity(p_monster);
            }
            else
            {
                Int32 num2 = num - 1;
                while (num != num2)
                {
                    if (num2 < 0)
                    {
                        num2 = 3;
                    }
                    if (grid.AddMovingEntity(position + (EDirection)num2, p_monster))
                    {
                        slot.RemoveEntity(p_monster);
                        break;
                    }
                    num2--;
                }
            }
            if (position != p_monster.Position && LegacyLogic.Instance.WorldManager.Party.SelectedMonster == p_monster)
            {
                LegacyLogic.Instance.WorldManager.Party.SelectedMonster = null;
            }
        }
Beispiel #29
0
        /// <summary>
        /// Grants EoC for casting spells
        /// </summary>
        private static void OnSpellEvent(SpellEventArgs args)
        {
            int   eoc   = 0;
            Spell spell = args.Spell;

            if (spell is MagerySpell)
            {
                eoc = (1 * ((int)((MagerySpell)spell).Circle + 1));
            }

            args.Player.EssenceOfCharacter += eoc;
        }
 protected override void HandleMonsterBuffs(Character p_sorcerer, SpellEventArgs p_result, Monster p_target, Single p_magicFactor)
 {
     if (!p_target.AbilityHandler.HasAbility(EMonsterAbilityType.LARGE))
     {
         base.HandleMonsterBuffs(p_sorcerer, p_result, p_target, p_magicFactor);
     }
     else
     {
         MonsterAbilityBase        ability = p_target.AbilityHandler.GetAbility(EMonsterAbilityType.LARGE);
         AbilityTriggeredEventArgs p_args  = new AbilityTriggeredEventArgs(p_target, ability);
         p_target.AbilityHandler.AddEntry(ability.ExecutionPhase, p_args);
     }
 }
Beispiel #31
0
 public static void InvokeSpellFinished( SpellEventArgs args )
 {
     if( SpellFinished != null )
         SpellFinished(args);
 }