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; } }
/// <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); }
/// <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)); }
//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)); }
/// <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)); }
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}"); }
/// <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)); }
/// <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); } }
/// <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(); }