Пример #1
0
        private void PrepareEnemy()
        {
            try {
                NWCreature self = (NWCreature)fSelf;

                // search nearest enemy
                NWCreature enemy = self.FindEnemy();

                if (enemy != null)
                {
                    if (IsShipSail)
                    {
                        PrepareChase(enemy, AttackRisk.Wary, false);
                        return;
                    }

                    AttackRisk ar;

                    RaceID race = self.Entry.Race;
                    if (GlobalVars.Debug_Fury || race == RaceID.crAesir || race == RaceID.crEvilGod || race == RaceID.crDaemon)
                    {
                        ar = AttackRisk.Immediately;
                    }
                    else
                    {
                        bool vent = self.Effects.FindEffectByID(EffectID.eid_Ventriloquism) != null;
                        if (vent)
                        {
                            ar = AttackRisk.Wait;
                        }
                        else
                        {
                            float arVal = self.GetAttackRate(enemy, Kinsfolks.Count);
                            ar = GetRiskKind(arVal);
                        }
                    }

                    switch (ar)
                    {
                    case AttackRisk.RunAway:
                    case AttackRisk.Evade:
                        PrepareEvade(enemy, ar, true);
                        break;

                    case AttackRisk.Wait:
                        // dummy
                        break;

                    case AttackRisk.Wary:
                    case AttackRisk.Immediately:
                        PrepareChase(enemy, ar, true);
                        break;
                    }
                }
            } catch (Exception ex) {
                Logger.Write("BeastBrain.prepareEnemy(): " + ex.Message);
            }
        }