示例#1
0
        public short AgressiveTarget(BrainFighter fighter, SpellLevelRecord level)
        {
            if (fighter.Brain.HasBehavior)
            {
                var agressiveCell = fighter.Brain.GetBehavior <Behavior>().GetAgressiveCell();

                if (agressiveCell != -1)
                {
                    return(agressiveCell);
                }
            }

            if (level.MaxRange > 0)
            {
                var targets = fighter.OposedTeam().CloserFighters(fighter);
                var target  = targets.LastOrDefault(x => x.Stats.InvisibilityState == Protocol.Enums.GameActionFightInvisibilityStateEnum.VISIBLE);

                if (target != null)
                {
                    return(target.CellId);
                }
                else
                {
                    return(Array.FindAll(fighter.GetCastZone(fighter.CellId, level), x => fighter.Fight.Map.WalkableDuringFight((ushort)x)).Random());
                }
            }
            else
            {
                return(fighter.CellId);
            }
        }
示例#2
0
        public short TeleportTarget(BrainFighter fighter, SpellLevelRecord level)
        {
            if (fighter.Brain.HasBehavior)
            {
                var teleportCell = fighter.Brain.GetBehavior <Behavior>().GetTeleportCell();

                if (teleportCell != -1)
                {
                    return(teleportCell);
                }
            }

            var target = fighter.OposedTeam().LowerFighter();



            if (target != null)
            {
                var points = target.Point.GetNearPoints();

                if (points.Count() > 0)
                {
                    var pt = points.FirstOrDefault(x => fighter.Fight.IsCellFree(x.CellId));

                    if (pt != null)
                    {
                        return(pt.CellId);
                    }
                }
            }
            return(-1);
        }
示例#3
0
 public Virustine(BrainFighter fighter) : base(fighter)
 {
     fighter.Fight.FightStartEvt += Fight_FightStartEvt;
     fighter.AfterSlideEvt       += Fighter_AfterSlideEvt;
     this.Fighter.OnTurnStartEvt += Fighter_OnTurnStartEvt;
     TurnCount = 0;
 }
示例#4
0
 public Powa(BrainFighter fighter)
     : base(fighter)
 {
     base.Fighter.BeforeDeadEvt += Fighter_OnDeadEvt;
     base.Fighter.AfterSlideEvt += Fighter_OnSlideEvt;
     this.Fighter.OnTurnEndEvt  += Fighter_OnTurnEndEvt;
     this.Fighter.OnDamageTaken += Fighter_OnDamageTaken;
 }
示例#5
0
 public Mansot(BrainFighter fighter)
     : base(fighter)
 {
     foreach (var ally in this.Fighter.Team.GetFighters())
     {
         ally.BeforeDeadEvt += this.ally_OnDeadEvt;
     }
 }
示例#6
0
        public MonsterBrain(BrainFighter fighter)
        {
            this.Fighter = fighter;

            if (fighter.Template.BehaviorName != string.Empty && fighter.Template.BehaviorName != null)
            {
                this.Behavior = BehaviorManager.GetBehavior(fighter.Template.BehaviorName, this.Fighter);
            }
        }
示例#7
0
 public AngelRush(BrainFighter fighter)
     : base(fighter)
 {
     this.SpellRecord            = SpellRecord.GetSpellRecord(SpellId);
     this.Fighter.AfterSlideEvt += Fighter_AfterSlideEvt;
     this.Fighter.AfterDeadEvt  += Fighter_AfterDeadEvt;
     this.Fighter.OnDamageTaken += Fighter_OnDamageTaken;
     this.IsAngel = false;
 }
示例#8
0
        public Barn(BrainFighter fighter)
            : base(fighter)
        {
            this.GradeRandomizer         = new AsyncRandom();
            fighter.Fight.FightStartEvt += Fight_FightStart;

            fighter.OnDamageTaken += fighter_OnDamageTaken;

            this.SummonedTemplate = MonsterRecord.GetMonster(SummonedMonsterId);
        }
示例#9
0
 public Royalmouth(BrainFighter fighter)
     : base(fighter)
 {
     this.Fighter.Fight.FightStartEvt += this.Fight_FightStart;
     this.Fighter.AfterSlideEvt       += this.Fighter_OnSlideEvt;
     this.Fighter.OnPushDamages       += this.Fighter_OnPushDamages;
     this.Fighter.OnTurnStartEvt      += this.fighter_OnTurnStartEvt;
     this.InitmouthRecord              = SpellRecord.GetSpellRecord(InitmouthSpellId);
     this.InitmouthLevel = this.InitmouthRecord.GetLastLevel();
 }
示例#10
0
        public Tabacille(BrainFighter fighter) : base(fighter)
        {
            fighter.Fight.FightStartEvt += Fight_FightStartEvt;
            this.Fighter.OnTurnStartEvt += Fighter_OnTurnStartEvt;

            foreach (var enemy in fighter.OposedTeam().GetFighters())
            {
                enemy.OnHealEvt += Enemy_OnHealEvt;
            }
            TurnCount = 0;
        }
示例#11
0
        public static Behavior GetBehavior(string behaviorName, BrainFighter fighter)
        {
            var data = BehaviorTypes.FirstOrDefault(x => x.Key == behaviorName);

            if (data.Value != null)
            {
                return((Behavior)Activator.CreateInstance(data.Value, fighter));
            }
            else
            {
                logger.Error("Unable to handle beahvior identifier: " + behaviorName);
                return(null);
            }
        }
示例#12
0
        /// <summary>
        /// Index = Priority
        /// </summary>
        /// <param name="fighter"></param>
        /// <returns></returns>
        public Dictionary <int, SpellCategoryEnum> GetSpellsCategories(BrainFighter fighter)
        {
            Dictionary <int, SpellCategoryEnum> categories;

            if (fighter.Brain.HasBehavior)
            {
                categories = fighter.Brain.GetBehavior <Behavior>().GetSpellsCategories();

                if (categories != null)
                {
                    return(categories);
                }
            }

            categories = new Dictionary <int, SpellCategoryEnum>();

            if (fighter.Team.LastDead() != null)
            {
                categories.Add(-1, SpellCategoryEnum.ReviveDeath);
            }

            if (fighter.CanSummon)
            {
                categories.Add(0, SpellCategoryEnum.Summon);
            }

            if (!fighter.IsThereEnemy(fighter.Point.GetNearPoints()))
            {
                categories.Add(1, SpellCategoryEnum.Teleport);
            }

            if (fighter.Stats.LifePercentage > WarningLifePercentage)
            {
                categories.Add(2, SpellCategoryEnum.Agressive);
            }
            else
            {
                categories.Add(5, SpellCategoryEnum.Agressive);
            }

            categories.Add(3, SpellCategoryEnum.Heal);
            categories.Add(4, SpellCategoryEnum.Buff);



            categories.Add(6, SpellCategoryEnum.Unknown);
            return(categories);
        }
示例#13
0
        public short BuffTarget(BrainFighter fighter, SpellLevelRecord level)
        {
            if (fighter.Brain.HasBehavior)
            {
                var buffCell = fighter.Brain.GetBehavior <Behavior>().GetBuffCell();

                if (buffCell != -1)
                {
                    return(buffCell);
                }
            }

            if (level.MaxRange > 0)
            {
                var target = fighter.Team.LowerFighterPercentage();
                return(target != null ? target.CellId : fighter.CellId);
            }
            else
            {
                return(fighter.CellId);
            }
        }
示例#14
0
        public List <ActionType> GetSortedActions(BrainFighter fighter)
        {
            List <ActionType> actions = new List <ActionType>();

            if (fighter.Brain.HasBehavior)
            {
                var behaviorActions = fighter.Brain.GetBehavior <Behavior>().GetSortedActions();

                if (behaviorActions != null)
                {
                    return(behaviorActions.ToList());
                }
            }

            actions.Add(ActionType.CastSpell);
            actions.Add(ActionType.MoveToEnemy);
            actions.Add(ActionType.CastSpell);
            actions.Add(ActionType.Flee);
            actions.Add(ActionType.CastSpell);

            return(actions);
        }
示例#15
0
        public short GetTargetedCell(BrainFighter fighter, SpellCategoryEnum category, SpellLevelRecord level)
        {
            if (fighter.Brain.HasBehavior)
            {
                var cellId = fighter.Brain.GetBehavior <Behavior>().GetTargetCellForSpell(level.SpellId);

                if (cellId != null)
                {
                    return(cellId.Value);
                }
            }
            var handler = Handlers.FirstOrDefault(x => x.Key.SpellCategory == category);

            if (handler.Value != null)
            {
                return((short)handler.Value.Invoke(this, new object[] { fighter, level }));
            }
            else
            {
                return(fighter.CellId);
            }
        }
示例#16
0
 public Malamibe(BrainFighter fighter) : base(fighter)
 {
     this.Fighter.OnTurnStartEvt += Fighter_OnTurnStartEvt;
 }
示例#17
0
 public Behavior(BrainFighter fighter)
 {
     this.Fighter = fighter;
 }
示例#18
0
 public SalbatroceBehavior(BrainFighter fighter) : base(fighter)
 {
     this.Fighter.OnTurnStartEvt += this.Fighter_OnTurnStartEvt;
 }
示例#19
0
 public DragonPig(BrainFighter fighter)
     : base(fighter)
 {
     this.LethalBlunderRecord          = SpellRecord.GetSpellRecord(LethalBlunderSpellId);
     this.Fighter.Fight.FightStartEvt += Fight_FightStart;
 }
示例#20
0
 public CastSpellAction(BrainFighter fighter)
     : base(fighter)
 {
 }
示例#21
0
 public Bacterrib(BrainFighter fighter) : base(fighter)
 {
     fighter.Fight.FightStartEvt += Fight_FightStartEvt;
     this.Fighter.OnTurnStartEvt += Fighter_OnTurnStartEvt;
     TurnCount = 0;
 }
示例#22
0
 public Puller(BrainFighter fighter)
     : base(fighter)
 {
     this.Fighter.OnTurnStartEvt += this.Fighter_OnTurnStartEvt;
 }
示例#23
0
 public HellMina(BrainFighter fighter)
     : base(fighter)
 {
     fighter.AfterSlideEvt += this.fighter_OnSlideEvt;
 }
示例#24
0
 public static BrainAction GetAction(BrainFighter fighter, ActionType actionType)
 {
     return((BrainAction)Activator.CreateInstance(Brains[actionType], new object[] { fighter }));
 }
示例#25
0
 public Agressive(BrainFighter fighter) : base(fighter)
 {
 }
示例#26
0
 public Verminocule(BrainFighter fighter) : base(fighter)
 {
     fighter.Fight.FightStartEvt += this.Fight_FightStartEvt;
     this.Fighter.OnTurnStartEvt += this.Fighter_OnTurnStartEvt;
     this.TurnCount = 0;
 }
示例#27
0
 public FleeAction(BrainFighter fighter)
     : base(fighter)
 {
 }
示例#28
0
 public Protect(BrainFighter fighter)
     : base(fighter)
 {
     fighter.BeforeDeadEvt += fighter_OnDeadEvt;
     fighter.Fight.OnFighters <CharacterFighter>(x => x.Character.Notification("Protegez " + Fighter.Name + "!"));
 }
示例#29
0
 public MoveToEnemyAction(BrainFighter fighter)
     : base(fighter)
 {
 }
示例#30
0
 public Sacrieur(BrainFighter fighter) : base(fighter)
 {
 }