Example #1
0
 public void AddDebuff(Debuff debuff)
 {
     if (!debuffs.Exists(x => x.GetType() == debuff.GetType()))      //check if debuff is new or not only apply if it is
     {
         newDebuffs.Add(debuff);
     }
 }
Example #2
0
        private static Debuff MakeRow(ThoughtDef t, int stage)
        {
            if (t.stages[stage] == null || String.IsNullOrEmpty(t.stages[stage].label))
            {
                return(null);
            }

            var row = new Debuff();

            row.Label                   = t.stages[stage].label;
            row.Description             = t.stages[stage].description;
            row.StackLimit              = t.stackLimit;
            row.DurationDays            = t.durationDays;
            row.StackedEffectMultiplier = t.stackedEffectMultiplier;

            var max = row.StackLimit < 5 ? row.StackLimit : 5;

            for (int i = 1; i <= max; ++i)
            {
                var xN = typeof(Debuff).GetProperty("X" + i);
                xN.SetValue(row, MoodOffsetOfGroup(t.stages[stage].baseMoodEffect, (float)row.StackedEffectMultiplier, i), null);
            }

            row.XMore = row.StackLimit > 5;

            return(row);
        }
Example #3
0
 public void Initialize(Transform target, float damage, Character source, Debuff debuff)
 {
     this.MyTarget = target;
     this.damage   = damage;
     this.Source   = source;
     this.debuff   = debuff;
 }
Example #4
0
    public void AddDebuff(Debuff debuff)
    {
        m_Debuffs.Add(debuff);

        switch (debuff.Type)
        {
        case Modifier.ANGLE:
            m_Shoulder.SetAngles(0, 0);
            break;

        case Modifier.JUMP:
            m_JumpForce *= debuff.Value;
            break;

        case Modifier.SPEED:
            m_MaxSpeed *= debuff.Value;
            break;

        case Modifier.DASH:
            m_DashStrength *= debuff.Value;
            break;
        }

        // TODO: Animation/Sound effect
    }
Example #5
0
        /// <summary>
        /// 移除一个在判定区的牌
        /// </summary>
        /// <param name="aCard">牌对象</param>
        /// <returns>移除成功返回true , 失败或者参数为null返回false</returns>
        public bool RemoveBuff(Card aCard)
        {
            if (aCard == null)
            {
                return(false);
            }
            Stack <Card> tmp = new Stack <Card>();
            bool         ret = false;

            while (Debuff.Count != 0)
            {
                if (aCard.Same(Debuff.Peek()))
                {
                    Debuff.Pop();
                    ret = true;
                }
                else
                {
                    tmp.Push(Debuff.Pop());
                }
            }
            while (tmp.Count != 0)
            {
                Debuff.Push(tmp.Pop());
            }
            return(ret);
        }
Example #6
0
        public override void OnApplied(Sprite Affected, Debuff debuff)
        {
            base.OnApplied(Affected, debuff);

            if (AcModifer.Option == Operator.Add)
                Affected.BonusAc += AcModifer.Value;

            if (Affected is Aisling)
            {
                (Affected as Aisling)
                    .Client
                    .SendAnimation(265,
                        (Affected as Aisling).Client.Aisling,
                        (Affected as Aisling).Client.Aisling.Target ??
                        (Affected as Aisling).Client.Aisling);

                var hpbar = new ServerFormat13
                {
                    Serial = Affected.Serial,
                    Health = 255,
                    Sound = 64
                };

                (Affected as Aisling).Show(Scope.Self, hpbar);
            }
            else
            {
                var nearby = Affected.GetObjects<Aisling>(Affected.Map, i => i.WithinRangeOf(Affected));

                foreach (var near in nearby)
                    near.Client.SendAnimation(226, Affected, Affected);
            }
        }
Example #7
0
 public void AddDebuff(Debuff debuff)
 {
     if (!debuffs.Exists(x => x.GetType() == debuff.GetType()))
     {
         newDebuffs.Add(debuff);
     }
 }
Example #8
0
    // look into delegates so that debuffs can all have a default function that activates their
    // respective coroutines, passing the debuff in particular as a parameter?
    public void ActivateDebuff(float multiplier, float duration, string debuffType)
    {
        if (isDead || debuffs == null)
        {
            return;
        }
        Debuff debuff = debuffs[debuffType];

        debuff.Refresh(multiplier, duration);
        if (!debuff.isActive)
        {
            debuff.isActive = true;
            switch (debuffType)
            {
            case "fire":
                StartCoroutine(Fire());
                break;

            case "acid":
                StartCoroutine(Acid());
                break;

            case "slow":
                StartCoroutine(Slow());
                break;
            }
        }
    }
Example #9
0
 public void RemoveDebuff(Debuff debuff)
 {
     if (debuffs.Contains(debuff))
     {
         debuffs.Remove(debuff);
     }
 }
    public void SpawnDebuffIcon(Debuff debuff)
    {
        GameObject debuffIcon = Instantiate(buffDebuffPrefab) as GameObject;

        debuffIcon.transform.SetParent(buffDebuffPanel.transform);
        debuffIcon.GetComponent <Buff_Debuff_Icon>().SetupIcon(DebuffSprites[(int)debuff.type], debuff.duration);
    }
Example #11
0
 public void Reset()
 {
     EnableCardInput(true);
     SetHealth(_maxHealth);
     SetStamina(_maxStamina);
     _debuff = Debuff.NONE;
 }
Example #12
0
    public Debuff DebuffMe(Debuff _myDebuff)
    {
        Debuff myDebuff = FindDebuff(_myDebuff.ID);

        if (myDebuff == null)
        {
            Debuffs[DebuffsAmount]      = _myDebuff;
            Debuffs[DebuffsAmount].icon = Object.Instantiate(Resources.Load("DebuffIcon"), soldier.frame.transform.position + new Vector3(0f, 0f, 0), soldier.frame.transform.rotation) as GameObject;
            Debuffs[DebuffsAmount].icon.transform.SetParent(GameObject.Find("Canvas").transform);
            Debuffs[DebuffsAmount].icon.transform.localScale = new Vector3(1, 1, 1);
            Debuffs[DebuffsAmount].icon.GetComponent <DebuffScript>().myParent = soldier.frame;
            Debuffs[DebuffsAmount].icon.GetComponent <DebuffScript>().myid     = DebuffsAmount;
            Debuffs[DebuffsAmount].SetIcon(GetDebuffIcon(_myDebuff.ID));
            Debuffs[DebuffsAmount].icon.GetComponent <DebuffScript>().SetParent(Debuffs[DebuffsAmount]);

            DebuffsAmount++;
        }
        else
        {
            myDebuff.Refresh(0);
        }

        soldier.UpdateDamageDoneBoost();
        soldier.UpdateDamageTakenBoost();
        soldier.UpdateHealingTakenBoost();

        return(myDebuff);
    }
Example #13
0
    private void FixedUpdate()
    {
        foreach (List <Debuff> listDebuff in dictionaryDebuff.Values)
        {            // reduce duration
            for (int i = 0; i < listDebuff.Count; ++i)
            {
                listDebuff[i].duration -= Time.deltaTime;
                if (listDebuff[i].duration <= 0f)
                {
                    listDebuff.RemoveAt(i);
                }
            }

            // do effect
            if (listDebuff.Count > 0)
            {
                Debuff current = listDebuff[0];
                for (int i = 1; i < listDebuff.Count; ++i)
                {
                    if (listDebuff[i] > current)
                    {
                        current = listDebuff[i];
                    }
                }

                current.DoEffect();
            }
        }
    }
        public override void OnDurationUpdate(Sprite affected, Debuff debuff)
        {
            if (affected is Aisling)
            {
                (affected as Aisling)
                .Client.SendLocation();

                (affected as Aisling)
                .Client.SendAnimation(41,
                                      (affected as Aisling).Client.Aisling,
                                      (affected as Aisling).Client.Aisling.Target ??
                                      (affected as Aisling).Client.Aisling);

                (affected as Aisling)
                .Client
                .SendMessage(0x02, "You've been incapacitated.");
            }
            else
            {
                var nearby = affected.GetObjects <Aisling>(affected.Map, i => affected.WithinRangeOf(i));

                foreach (var near in nearby)
                {
                    if (near?.Client == null)
                    {
                        continue;
                    }

                    var client = near.Client;
                    client.SendAnimation(41, affected, client.Aisling);
                }
            }

            base.OnDurationUpdate(affected, debuff);
        }
Example #15
0
 public void RemoveDebuff(Debuff debuff)
 {
     if (!debuffsToRemove.Exists(x => x.GetType() == debuff.GetType()))
     {
         debuffsToRemove.Add(debuff);
     }
 }
        public override void OnApplied(Sprite Affected, Debuff debuff)
        {
            base.OnApplied(Affected, debuff);

            if (Affected is Aisling)
            {
                (Affected as Aisling)
                .Client
                .SendAnimation(40,
                               (Affected as Aisling).Client.Aisling,
                               (Affected as Aisling).Client.Aisling.Target ??
                               (Affected as Aisling).Client.Aisling);

                var hpbar = new ServerFormat13
                {
                    Serial = Affected.Serial,
                    Health = 255,
                    Sound  = 123
                };

                (Affected as Aisling).Show(Scope.Self, hpbar);
            }
            else
            {
                var nearby = Affected.GetObjects <Aisling>(Affected.Map, i => i.WithinRangeOf(Affected));

                foreach (var near in nearby)
                {
                    near.Client.SendAnimation(40, Affected, Affected);
                }
            }
        }
Example #17
0
 public void AddDebuff(Debuff debuff)
 {
     if (!debuffs.Exists(x => x.GetType() == debuff.GetType()))  // Looks through the debuffs list, and for each x element in the list, check to see if that element's debuff type is equivalent to the method argument's debuff type
     {
         newDebuffs.Add(debuff);
     }
 }
Example #18
0
    protected virtual void Start()
    {
        //EXPERIMENTAL RECHARGING SHIELD
        initialShieldCapacity     = shieldCapacity;
        initalShieldRechargeDelay = shieldRechargeDelay;
        //END OF EXPERIMENTAL RECHARGING SHIELD
        initialHp    = health;
        initialSpeed = speed;

        if (armor > 1)
        {
            armor = 1;
        }
        initialArmor = armor;

        fire = new Debuff(true);
        acid = new Debuff(false);
        slow = new Debuff(false);

        debuffs = new Dictionary <Enums.Element, Debuff>
        {
            { Enums.Element.fire, fire },
            { Enums.Element.acid, acid },
            { Enums.Element.ice, slow }
        };
        Zero();
    }
Example #19
0
        /// <summary>
        /// Remove a Debuff from the Monster
        /// </summary>
        /// <returns>Whether or not the Debuff existed before removal</returns>
        public bool RemoveDebuff(Debuff debuff)
        {
            bool retBool = Debuffs.ContainsKey(debuff);

            Debuffs.Remove(debuff);
            return(retBool);
        }
Example #20
0
    private void CreateDisabler(float offset, Debuff toDisable)
    {
        Disabler newDisabler = Instantiate(_disablerPrefab);

        switch (toDisable)
        {
        case Debuff.CANNOTHEAD:
            newDisabler.Initialize(_meleeSprites[2], toDisable, "Disable Head");
            break;

        case Debuff.CANNOTBODY:
            newDisabler.Initialize(_meleeSprites[1], toDisable, "Disable Body");
            break;

        case Debuff.CANNOTLEGS:
            newDisabler.Initialize(_meleeSprites[0], toDisable, "Disable Legs");
            break;

        default:
            Debug.Log("Could not debuff");
            break;
        }

        newDisabler.OnActivate        += OnItemChosen;
        newDisabler.transform.position = _itemPosition.position + new Vector3(offset, 0, 0);
        newDisabler.transform.SetParent(transform);
        _itemActions.Add(newDisabler);
    }
Example #21
0
    public virtual void ActivateDebuff(float multiplier, float duration, Enums.Element debuffType)
    {
        if (status == Enums.Status.disable || debuffs == null)
        {
            return;
        }

        if (debuffType == element)
        {
            return;
        }

        Debuff debuff = debuffs[debuffType];

        debuff.Refresh(multiplier, duration);
        if (!debuff.isActive)
        {
            debuff.isActive = true;
            switch (debuffType)
            {
            case Enums.Element.fire:
                StartCoroutine(ApplyFire());
                break;

            case Enums.Element.acid:
                StartCoroutine(ApplyAcid());
                break;

            case Enums.Element.ice:
                StartCoroutine(ApplySlow());
                break;
            }
        }
    }
Example #22
0
        public override void OnEnded(Sprite Affected, Debuff debuff)
        {
            if (Affected.CurrentMapId == ServerContextBase.GlobalConfig.DeathMap)
            {
                base.OnEnded(Affected, debuff);
                return;
            }

            if (Affected is Aisling && !debuff.Cancelled)
            {
                (Affected as Aisling)
                .Client
                .SendMessage(0x02, "You have died.");

                var hpbar = new ServerFormat13
                {
                    Serial = Affected.Serial,
                    Health = 255,
                    Sound  = 5
                };

                (Affected as Aisling).Show(Scope.Self, hpbar);
                (Affected as Aisling).Flags = AislingFlags.Dead;
                (Affected as Aisling).CastDeath();
                (Affected as Aisling).SendToHell();
            }

            base.OnEnded(Affected, debuff);
        }
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject == owner)
        {
            return;
        }

        IDamagable applyDamage = collision.gameObject.GetComponent <IDamagable>();

        if (applyDamage != null)
        {
            applyDamage.Damage(damage);
            if (debuffs != null)
            {
                //applyDamage.AddDebuff(debuffs());
                foreach (AttackDebuffs debuff in debuffs.GetInvocationList())
                {
                    Debuff d = debuff();
                    applyDamage.AddDebuff(d);
                    Debug.Log($"Added Debuff {d}");
                }
            }
        }
        ContactPoint hit = collision.GetContact(0);

        Instantiate(ImpactEffect, hit.point, Quaternion.LookRotation(hit.normal));

        if (maxBounces > 0)
        {
            maxBounces--;
            Vector3 newDirection = Vector3.Reflect(currentVelocity, hit.normal);
            rbody.AddForce(newDirection, ForceMode.Impulse);
        }
    }
        public override void OnApplied(Sprite Affected, Debuff debuff)
        {
            base.OnApplied(Affected, debuff);

            if (Affected is Aisling)
            {
                (Affected as Aisling)
                .Client
                .SendAnimation(32,
                               (Affected as Aisling).Client.Aisling,
                               (Affected as Aisling).Client.Aisling.Target ??
                               (Affected as Aisling).Client.Aisling);

                return;
            }
            else
            {
                var nearby = Affected.GetObjects <Aisling>(i => i.WithinRangeOf(Affected));

                foreach (var near in nearby)
                {
                    near.Client.SendAnimation(32, Affected, Affected);
                }
            }
        }
Example #25
0
    public void InflictDebuff(Debuff debuff, float time)
    {
        switch (debuff)
        {
        case Debuff.BURN:
            burned.SetActive(true);
            burnTime = time;
            break;

        case Debuff.POISON:
            poisoned.SetActive(true);
            poisonTime = time;
            break;

        case Debuff.BLEED:
            bleeding.SetActive(true);
            bleedTime = time;
            break;

        case Debuff.SLOW:
            slowTime = time;
            break;

        case Debuff.PARALYSE:
            paralyseTime = time;
            break;

        default:
            break;
        }
    }
    private void DebuffTicker()
    {
        if (Debuffs.Count == 0)
        {
            return;
        }

        for (int i = 0; i < Debuffs.Count; i++)
        {
            Debuff modded = new Debuff
            {
                type       = Debuffs[i].type,
                percentage = Debuffs[i].percentage,
                duration   = Debuffs[i].duration - 1.0f
            };

            if (modded.duration <= 0.0f)
            {
                RemoveDebuff(i);
            }
            else
            {
                Debuffs[i] = modded;
            }
        }
    }
        public bool Update()
        {
            switch (nType)
            {
            case AffectedAreaType.UserSkill:
                foreach (var mob in Field.Mobs)
                {
                    if (!rcArea.PointInRect(mob.Position.CurrentXY))
                    {
                        continue;
                    }

                    mob.TryApplySkillDamageStatus
                        (Field.Users[dwOwnerId], nSkillID, nSLV, 0);
                }
                break;

            case AffectedAreaType.BlessedMist:                     // TODO fix the recovery numbers, its incorrect rn
            {
                var rate = MasterManager.SkillTemplates[nSkillID].X(nSLV) * 0.01;
                foreach (var user in Field.Users)
                {
                    if (!rcArea.PointInRect(user.Position.CurrentXY))
                    {
                        continue;
                    }

                    user.Modify.Heal(0, (int)(user.BasicStats.nMMP * rate));

                    var effect = new UserEffectPacket(UserEffect.SkillAffected)
                    {
                        nSkillID = nSkillID,
                        nSLV     = nSLV,
                    };

                    effect.BroadcastEffect(user);
                }
            }
            break;

            case AffectedAreaType.MobSkill:
                foreach (var user in Field.Users)
                {
                    if (!rcArea.PointInRect(user.Position.CurrentXY))
                    {
                        continue;
                    }

                    var toAdd = new Debuff(nSkillID, nSLV);
                    toAdd.StatType = SecondaryStatFlag.Poison;
                    toAdd.Generate();
                    user.Buffs.Remove(toAdd.nBuffID);
                    user.Buffs.Add(toAdd);
                }
                break;
            }

            return(StartTime.MillisSinceStart() >= Duration);
        }
Example #28
0
 /// <summary>
 /// New unstable static effect
 /// </summary>
 public DebuffEffect(string name, Debuff debuffType, int damage, int duration)
 {
     EffectName         = name;
     DebuffType         = debuffType;
     Duration           = duration;
     EffectDurationType = EffectDuration.OverTime;
     Damage             = damage;
 }
Example #29
0
        public static void ExecuteAction(Action action, Hero player, Hero target)
        {
            HeroCooldownReductor.ReduceCooldowns(player);
            Debuff buff = (Debuff)action;

            buff.GivePlayerDebuff(buff, player, target);
            ActionResult.ShowActionResult($"{target.Name} GOT DEBUFFED WITH {action.Name} BY {player.Name}");
        }
Example #30
0
 protected override void OnEnable()
 {
     base.OnEnable();
     gameObject.GetComponent <Collider>().enabled = true;
     debuff = new Debuff(LetStun);
     damage = new Damage(50, DamageType.Physical);
     StartCoroutine(ValidTrigger());
 }
Example #31
0
        public void AddDebuff(int id, string name, string instance_name, DebuffTypes type)
        {
            using (StreamReader mr = new StreamReader("Debuffs.xml"))
            {
                file = (XMLDebuffContainer)xml_serialize.Deserialize(mr);
            }

            Debuff debuf = new Debuff();
            debuf.id = id;
            debuf.name = name;
            debuf.type = type;
            debuf.instance_name = instance_name;

            file.debuff_arr.Add(debuf);

            using (StreamWriter sw = new StreamWriter("Debuffs.xml"))
            {
                xml_serialize.Serialize(sw, file);
                sw.Flush();
            }
        }
Example #32
0
    /// <summary>
    /// Damages the enemy over time. Takes into acount the enemy's armor.
    /// </summary>
    public void DamageOverTime(int damage, float duration, float interval, EnemyState enemyState, int towerElement)
    {
        if(towerElement == elementType)
            return;

        int dot = damage;
        if (dot > 0)
        {
            Debuff debuff = new Debuff(this, dot, duration, interval, Time.time, enemyState);
            debuffs.Add(debuff);
        }

        // In case we want armor to be used again.
        //int armorOffsetDamage = damage - armor;

        //if (armorOffsetDamage > 0) {
        //    armorOffsetDamage = armorOffsetDamage / (int)(duration / interval);
        //    Debuff debuff = new Debuff (this, armorOffsetDamage, duration, interval, Time.time, enemyState);
        //    debuffs.Add (debuff);
        //}
    }
Example #33
0
 /// <summary>
 /// Applies the given debuff. If the debuff is already on the Player, and the debuff is allowed to be refreshed, its
 /// duration is reset.
 /// </summary>
 /// <param name='debuff'>
 /// The debuff to apply.
 /// </param>
 public void applyDebuff(Debuff debuff)
 {
     if(debuffs.ContainsKey(debuff.name()) && debuff.prolongable()){
         Debuff currentDebuff = (Debuff) debuffs[debuff.name()];
         currentDebuff.refresh();
     }
     else {
         debuff.apply(this);
         debuffs.Add(debuff.name(), debuff);
     }
 }
Example #34
0
    /// <summary>
    /// Reduces the armor.
    /// </summary>
    public void ReduceArmor(int amount, float duration, int towerElement)
    {
        if(towerElement == elementType)
            return;

        Debuff debuff = new Debuff (this, amount, duration, 0, Time.time, EnemyState.ReducedArmor);
        debuffs.Add (debuff);
    }
Example #35
0
    //Note: percentage is 0-1 not 0-100
    public void Slow(float percentage, float duration, int towerElement)
    {
        if(towerElement == elementType)
            return;

        int amountToSlow = (int)(speed * percentage);
        Debuff debuff = new Debuff (this, amountToSlow, duration, 0, Time.time, EnemyState.Slow);
        debuffs.Add (debuff);
    }
Example #36
0
 /// <summary>
 /// Applies a specified Debuff to the minion.
 /// </summary>
 /// <param name='debuff'>
 /// The Debuff to be applied.
 /// </param>
 /// <param name='stacking'>
 /// If the Debuff is stackable.
 /// NOTE: This is no longer neccessary, as the Debuff tracks if it is stackable.
 /// </param>
 public void applyDebuff(Debuff debuff, bool stacking)
 {
     if(debuffs.ContainsKey(debuff.name())) {
         Debuff currentDebuff = (Debuff) debuffs[debuff.name()];
         if(debuff.prolongable()){
             currentDebuff.refresh();
         }
         else if(debuff.stackable())
             currentDebuff.applyStack(1);
     }
     else
         debuffs.Add(debuff.name(), debuff);
 }
Example #37
0
    /// <summary>
    /// Makes the enemy move backwards along it's path.
    /// </summary>
    public void MindControl(float duration, int towerElement)
    {
        if(towerElement == elementType)
            return;

        if (duration <= 0)
            return;

        Debuff debuff = new Debuff (this, 0, duration, 0, Time.time, EnemyState.MindControl);
        debuffs.Add (debuff);
    }