Example #1
0
 public override void StartAITurn()
 {
     if (m_owner.IsAggro)
     {
         if (m_state == EErebosState.VANISHED)
         {
             if (LegacyLogic.Instance.WorldManager.Party.CurrentMapArea == EMapArea.SAFE_ZONE)
             {
                 m_owner.ForceAggro(false);
             }
             else
             {
                 m_roundCounter++;
                 if (m_roundCounter >= m_appearMaxCounter && Random.Value <= m_appearProbability)
                 {
                     MakeAttackDesicion();
                     m_roundCounter = 0;
                 }
             }
         }
         if (m_firstFightRound)
         {
             m_state = EErebosState.VANISHING;
             m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
             DoVanish();
             m_firstFightRound = false;
         }
     }
 }
Example #2
0
 public override void Update()
 {
     if (m_state == EErebosState.APPEARING && m_owner.AppearAnimationDone.IsTriggered)
     {
         m_owner.AppearAnimationDone.Reset();
         AttackParty();
     }
     if (m_state == EErebosState.VANISHING && m_owner.VanishAnimationDone.IsTriggered)
     {
         m_state = EErebosState.VANISHED;
         m_owner.VanishAnimationDone.Reset();
         m_owner.EndTurn();
         m_owner.m_stateMachine.ChangeState(Monster.EState.IDLE);
     }
     if (m_state == EErebosState.SPELLCASTING && (m_owner.State == Monster.EState.ACTION_FINISHED || m_owner.State == Monster.EState.IDLE))
     {
         if (m_lastCastedSpell != EMonsterSpell.BACKSTAB)
         {
             m_state = EErebosState.VANISHING;
             DoVanish();
         }
         else
         {
             m_state = EErebosState.IDLE;
             m_owner.m_stateMachine.ChangeState(Monster.EState.ACTION_FINISHED);
         }
     }
     if (!m_owner.IsAggro && LegacyLogic.Instance.WorldManager.Party.CurrentMapArea == EMapArea.NONE && m_state == EErebosState.VANISHED)
     {
         m_owner.IsAggro = true;
     }
 }
Example #3
0
 private void Appear()
 {
     if (m_targetSlot != null)
     {
         Grid     grid     = LegacyLogic.Instance.MapLoader.Grid;
         Position position = m_owner.Position;
         grid.GetSlot(m_owner.Position).RemoveEntity(m_owner);
         m_targetSlot.AddEntity(m_owner);
         m_owner.Position  = m_targetSlot.Position;
         m_owner.Direction = EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position);
         m_state           = EErebosState.APPEARING;
         UpdateDistanceToParty(LegacyLogic.Instance.WorldManager.Party, grid);
         m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
         BaseObjectEventArgs p_eventArgs = new BaseObjectEventArgs(m_owner, m_owner.Position, "APPEARING");
         LegacyLogic.Instance.EventManager.InvokeEvent(m_owner, EEventType.SET_ENTITY_POSITION, p_eventArgs);
     }
 }
Example #4
0
 public override Boolean CastSpell(MonsterSpell p_spell)
 {
     if (CastSpellErebos(p_spell))
     {
         m_owner.CombatHandler.CastedSpell = p_spell;
         m_owner.CombatHandler.CastSpell   = true;
         if (p_spell.TargetType == ETargetType.PARTY)
         {
             m_owner.DivideAttacksToPartyCharacters = true;
         }
         m_owner.BuffHandler.DoOnCastSpellEffects();
         m_owner.CombatHandler.DoAttack();
         m_lastCastedSpell = p_spell.SpellType;
         m_state           = EErebosState.SPELLCASTING;
         return(true);
     }
     return(false);
 }
Example #5
0
 private void AttackParty()
 {
     if (m_decision == EMonsterStrategyDecision.MELEE || Position.Distance(LegacyLogic.Instance.WorldManager.Party.Position, m_owner.Position) < 1.1f)
     {
         if (m_state == EErebosState.APPEARING)
         {
             MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(28);
             CastSpell(p_spell);
         }
         else
         {
             m_state = EErebosState.IDLE;
             m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
             DoMelee(true, LegacyLogic.Instance.WorldManager.Party, LegacyLogic.Instance.MapLoader.Grid, LegacyLogic.Instance.MapLoader.Grid.GetSlot(m_owner.Position));
         }
     }
     else if (m_decision == EMonsterStrategyDecision.RANGED || Position.Distance(LegacyLogic.Instance.WorldManager.Party.Position, m_owner.Position) > 1.1f)
     {
         MonsterSpell p_spell2 = m_owner.SpellHandler.SelectSpellByID(20);
         CastSpell(p_spell2);
         m_state = EErebosState.SPELLCASTING;
     }
 }
Example #6
0
 public override void Load(SaveGameData p_data)
 {
     m_firstFightRound = p_data.Get <Boolean>("FirstRound", true);
     m_lastCastedSpell = p_data.Get <EMonsterSpell>("LastCastedSpell", m_lastCastedSpell);
     m_state           = p_data.Get <EErebosState>("State", m_state);
 }
Example #7
0
 public ErebosAIHandler(Monster p_owner) : base(p_owner)
 {
     m_percentEvent            = new AIEventHealthPercent(0.7f, m_owner, true);
     m_percentEvent.OnTrigger += OnHealAndVanishEvent;
     m_state = EErebosState.IDLE;
 }