示例#1
0
        public override void Update(GameTime time)
        {
            var mob = _mobFunc();

            if (mob != null)
            {
                var game       = _gameFunc();
                var mobManager = game.MobManager;

                // Update and rendering are skipped if the ability isn't present
                if (_abilityIndex < mob.MobInfo.Abilities.Count)
                {
                    Entity.Hidden = false;
                }
                else
                {
                    Entity.Hidden = true;
                    return;
                }

                var abilityId = mob.MobInfo.Abilities[_abilityIndex];
                _abilityInfo = mobManager.AbilityForId(abilityId);

                var inputManager = InputManager.Instance;
                var aabb         = new Rectangle(Entity.RenderPosition.ToPoint(),
                                                 Entity.LayoutSize.ToPoint());

                if (inputManager.JustLeftClickReleased())
                {
                    if (aabb.Contains(inputManager.MousePosition))
                    {
                        EnqueueClickEvent(() => OnClick?.Invoke(_abilityIndex));
                    }
                }

                _dmgLabel.Text   = _abilityInfo.Dmg.ToString();
                _abLabel.Text    = _abilityInfo.Cost.ToString();
                _rangeLabel.Text = _abilityInfo.Range.ToString();

                var buff = _abilityInfo.Buff.IsZero ? Buff.ZeroBuff() : _abilityInfo.Buff;
                _buffLabel.Text =
                    $"{buff.HpChange}/{buff.ApChange} " +
                    $"({buff.Lifetime} turns)";

                var areaBuff = _abilityInfo.AreaBuff.IsZero ? AreaBuff.ZeroBuff() : _abilityInfo.AreaBuff;
                _areaBuffLabel.Text =
                    $"{areaBuff.Effect.HpChange}/{areaBuff.Effect.ApChange} " +
                    $"({areaBuff.Effect.Lifetime} turns, {areaBuff.Radius}r)";

                _cooldownLabel.Text = _abilityInfo.Cooldown.ToString();
            }
        }
示例#2
0
        public static AreaBuff RandomAreaBuff()
        {
            var buff = new AreaBuff(AxialCoord.Zero, Random.Next(4), RandomBuff());

            if (buff.Radius < 2)
            {
                return(AreaBuff.ZeroBuff());
            }
            else
            {
                return(buff);
            }
        }
示例#3
0
        public AreaBuff ToBuff()
        {
            var res = new AreaBuff(Coord, Radius, Effect.ToBuff());

            return(res.IsZero ? AreaBuff.ZeroBuff() : res);
        }