Exemplo n.º 1
0
    public void AddBuff(Buff buff, bool can_stack)
    {
        if (BattleBase.Instance.IsBattleEnd == true)
        {
            return;
        }

        if (buff.IsMainBuff == true && can_stack == false)
        {
            foreach (Buff find_buff in Buffs.FindAll(b => b.Skill == buff.Skill))
            {
                find_buff.Finish();
            }
        }

        buff.EndTime = PlaybackTime + buff.Duration;
        buff.DoAction();
        Buffs.Add(buff);
        //        Buffs.Sort(Buff.SortByEndTime);

        if (buff.BuffContainer.Asset)
        {
            HPBar.AddBuff(buff.BuffContainer.Asset);
        }

        switch (buff.ActionInfo.actionType)
        {
        case eActionType.buff:
        case eActionType.debuff:
        case eActionType.buff_percent:
        case eActionType.debuff_percent:
            RefreshStat();
            break;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Method is called at the start of each turn.
    /// </summary>
    public virtual void OnTurnStart()
    {
        MovementPoints = TotalMovementPoints;
        ActionPoints   = TotalActionPoints;
        Cell.Occupent  = this;
        if (Buffs.Any())
        {
            List <Buff> dotlist = Buffs.FindAll(b => b.isDot);
            if (dotlist != null)
            {
                foreach (Buff b in dotlist)
                {
                    b.Trigger(this);
                }
            }
        }
        if (TotalHitPoints == 120)
        {
            WarriorBuff warbuff = new WarriorBuff();
            warbuff.Apply(this);
        }
        SetState(new UnitStateMarkedAsFriendly(this));
        Animator anim = GetComponentInChildren <Animator>();

        anim.SetBool("Attack", false);
        anim.SetBool("Skill", false);
        anim.SetBool("Idle", true);
    }
Exemplo n.º 3
0
    /// <summary>
    /// Method is called at the end of each turn.
    /// </summary>
    public virtual void OnTurnEnd()
    {
        Buffs.FindAll(b => b.Duration == 0).ForEach(b => { b.Undo(this); });
        Buffs.RemoveAll(b => b.Duration == 0);
        Buffs.ForEach(b => { b.Duration--; });

        SetState(new UnitStateNormal(this));
    }
Exemplo n.º 4
0
    //MoveShip ();


    //TODO 100
    //int number = cellgrid.GetComponents<RectangularHexGridGenerator>
    /// <summary>
    /// Method is called at the end of each turn.
    /// </summary>
    public override void OnTurnEnd()
    {
        Debug.Log("Space SpaceMover OnTurnEnd called");
        Buffs.FindAll(b => b.Duration == 0).ForEach(b => { b.Undo(this); });
        Buffs.RemoveAll(b => b.Duration == 0);
        Buffs.ForEach(b => { b.Duration--; });

        SetState(new UnitStateNormal(this));
    }
Exemplo n.º 5
0
    /// <summary>
    /// Method is called at the end of each turn.
    /// </summary>
    public virtual void OnTurnEnd()
    {
        Buffs.FindAll(b => b.Duration == 0).ForEach(b => { b.Undo(this); });
        Buffs.RemoveAll(b => b.Duration == 0);
        Buffs.ForEach(b => { b.Duration--; });
        Animator anim = GetComponentInChildren <Animator>();

        SetState(new UnitStateNormal(this));
    }
Exemplo n.º 6
0
        public void BuffStep()
        {
            double HealthGained = Buffs.FindAll(x => x.TargetAttribute == Boon.Target.Health && !x.IsNegative).Sum(x => x.Value);
            double HealthLost   = Buffs.FindAll(x => x.TargetAttribute == Boon.Target.Health && x.IsNegative).Sum(x => x.Value);

            ApplyDamage(-HealthGained);
            ApplyDamage(HealthLost);
            Console.WriteLine($"Net gain: {HealthGained}\nNet lost:{HealthLost}");
        }
Exemplo n.º 7
0
    /// <summary>
    /// Method is called at the end of each turn.
    /// </summary>
    public virtual void OnTurnEnd()
    {
        Buffs.FindAll(b => b.Duration == 0).ForEach(b => { b.Undo(this); });
        Buffs.RemoveAll(b => b.Duration == 0);
        Buffs.ForEach(b => { b.Duration--; });

        //handlecapture in this method
        if (canCapture && isAbleToCapture)
        {
        }

        ResetToNeutralState();
        prevPosition = this.transform.position;
        prevCell     = Cell;
        SetState(new UnitStateNormal(this));
    }
Exemplo n.º 8
0
        /// <summary> Updates the creature's ongoing effects </summary>
        public void HandleBuffs(DwarfTime time)
        {
            if (BuffsToAdd == null)
            {
                BuffsToAdd = new List <Buff>();
            }
            Buffs.AddRange(BuffsToAdd);
            BuffsToAdd.Clear();
            foreach (Buff buff in Buffs)
            {
                buff.Update(time, this);
            }

            List <Buff> doneBuffs = Buffs.FindAll(buff => !buff.IsInEffect);

            foreach (Buff buff in doneBuffs)
            {
                buff.OnEnd(this);
                Buffs.Remove(buff);
            }
        }
Exemplo n.º 9
0
    /// <summary>
    /// Method is called at the end of each turn.
    /// </summary>
    public virtual void OnTurnEnd()
    {
        Buffs.FindAll(b => b.Duration == 0).ForEach(b => { b.Undo(this); });
        Buffs.RemoveAll(b => b.Duration == 0);
        Buffs.ForEach(b => { b.Duration--; });

        SetState(new UnitStateNormal(this));
        isTurnEnd = true;

        if (this.tag == "Player")
        {
            int nextIndex = this.GetComponent <Avatar>().AvatarIndex + 1;
            if (nextIndex > 3)
            {
                nextIndex = 0;
            }
            moveToNextAvatar(nextIndex);
        }

        //Debug.Log("Player Number: "+PlayerNumber);
        //selectUnitBtn();
    }