Beispiel #1
0
        public override void Init(int id, int type, int metaId, float lifeTime, float mainValue, int calculateType)
        {
            this.id            = id;
            this.type          = (DebuffType)type;
            this.metaId        = metaId;
            this.calculateType = (CalculateType)calculateType;
            this.duration      = Mathf.RoundToInt(lifeTime * GameConstants.LOGIC_FIXPOINT_PRECISION);

            if (this.calculateType == CalculateType.NaturalNumber)
            {
                this.mainValue = Mathf.RoundToInt(mainValue);
            }
            else if (this.calculateType == CalculateType.Percent)
            {
                this.mainValue = ConvertUtils.ToLogicInt(mainValue);
            }

            attributeAffectType = AttributeAffectType.Debuff;

            if (this.duration == infiniteTimeTag)
            {
                infinite = true;
            }
            else
            {
                infinite = false;
            }
        }
Beispiel #2
0
 public void Instantiate(DebuffType type)
 {
     if (_prefab.ContainsKey(type))
     {
         _existEffect[type] = GameObject.Instantiate(_prefab[type], _parent);
     }
 }
 public Debuff(DebuffType _type, float _time, float _amount, GameObject _effect) //add bool for buffs or debuffs
 {
     type   = _type;
     time   = _time;
     amount = _amount;
     effect = _effect;
 }
Beispiel #4
0
    IEnumerator DebuffRecoverer(DebuffType type, GameObject DebuffEff, float timeLimit, float originSpeed = -1)
    {
        // 방해효과 이펙트 표시
        GameObject obj = Instantiate(DebuffEff, transform.position, Quaternion.identity);

        float timer = 0f;

        while (timer < timeLimit)
        {
            timer += Time.deltaTime;
            yield return(null);
        }

        // 이펙트 삭제
        Destroy(obj);

        switch (type)
        {
        case DebuffType.Soju:
            AssultStart();
            break;

        case DebuffType.Phone:
            status.speed = originSpeed;
            break;
        }
    }
Beispiel #5
0
 public void Destroy(DebuffType type)
 {
     if (_existEffect.ContainsKey(type))
     {
         GameObject.Destroy(_existEffect[type]);
         _existEffect.Remove(type);
     }
 }
    public static IDebuff GetDebuff(DebuffType type)
    {
        switch (type)
        {
        }

        Debug.LogError("当前状态并不在工厂的配置中,类型:" + type);
        return(null);
    }
Beispiel #7
0
        public static int getDebuffLevel(int actorId, int injuryPower, int injuryId)
        {
            DebuffType    debuffType    = getDebuffType(injuryId);
            DebuffSubType debuffSubType = getDebuffSubType(injuryId);
            int           injuryDamage  = int.Parse(DateFile.instance.injuryDate[injuryId][(int)debuffSubType + 1]);
            int           maxCanDamage  = debuffSubType == 0 ? ActorMenu.instance.MaxHp(actorId) : ActorMenu.instance.MaxSp(actorId);

            return(injuryDamage * debuffRate[debuffType] / maxCanDamage);
        }
Beispiel #8
0
        private void SyncDebuffRPC(int targetViewID, DebuffType debuffType, float duration)
        {
            var target = PhotonView.Find(targetViewID).gameObject.GetComponent <IOnDebuffed>();

            Assert.IsNotNull(target);

            var flow = new DebuffFlow(target, debuffType, duration);

            SkillStream.OnNextDebuff(flow);
        }
 static bool isStackingDebuff(DebuffType _type)
 {
     if (_type == DebuffType.LaserSlow || _type == DebuffType.Freeze || _type == DebuffType.Fear)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 protected virtual void ExecuteDebuff(DebuffType type)
 {
     if (_canDebuffs.Contains(type))
     {
         var debuff = GetDebuffObject(type);
         if (debuff != null)
         {
             debuff.Start(_msgMgr);
         }
     }
 }
Beispiel #11
0
 public void SetDebuff(DebuffType _type, float _amount, float _duration)
 {
     if (!ReferenceEquals(debuffs, null) && debuffs[_type].isApplied.Equals(false))
     {
         debuffs[_type].Initialize(_amount, _duration);
     }
     else
     {
         debuffs[_type].Restart();
     }
 }
 private IDebuff GetDebuffObject(DebuffType type)
 {
     if (_debuffs.ContainsKey(type))
     {
         return(_debuffs[type]);
     }
     else
     {
         IDebuff debuff = SpecialStateFactory.GetDebuff(type);
         _debuffs.Add(type, debuff);
         return(debuff);
     }
 }
    //
    //Enemy functions
    //
    public static void AddDebuff(Enemy e, DebuffType _type, float _time, float _amount, GameObject _effect = null)
    {
        if (e.debuffLimitActive && (_type == DebuffType.Fear || _type == DebuffType.Freeze))
        {
            return;
        }
        if (e.shield > 0 && _type != DebuffType.Heal && _type != DebuffType.ShieldBreak)   //Don't debuff shielded enemies, Negative value debuffs(buffs) and heals go through (and shieldbreak)
        {
            if (_amount >= 0f)
            {
                return;
            }
        }
        if (isStackingDebuff(_type))                                        //If the type can be stacked
        {
            for (int i = e.debuffList.Count - 1; i >= 0; --i)               //Check each current debuff
            {
                if (e.debuffList[i].type == _type)                          //And if it's already in the list
                {
                    if (_effect != null)                                    //If it has an effect..
                    {
                        if (e.debuffList[i].effect.CompareTag(_effect.tag)) //check if they are the same, if so just update the values for the debuff
                        {
                            CalcDebuffSimple(ref e.debuffList[i].time, _time, ref e.debuffList[i].amount, _amount);
                            return;
                        }
                        //If the effects are different, make a seperate debuff with the new effect
                    }
                    else
                    {                                               //If there is no effect to be added, just update the debuff values
                        CalcDebuffSimple(ref e.debuffList[i].time, _time, ref e.debuffList[i].amount, _amount);
                        return;
                    }
                }
            }
        }
        //if debuff doesn't already exist or it can't be stacked, add it and if it has an effect instantiate that
        if (_effect != null)
        {
            GameObject effectIns = GameObject.Instantiate(_effect, e.transform.position, Quaternion.Euler(0, 0, 0)); //Don't want the effect rotating with the enemy i believe
            effectIns.transform.localScale = e.debuffEffectScale;
            effectIns.transform.SetParent(e.transform);
            e.debuffList.Add(new Debuff(_type, _time, _amount, effectIns));
        }
        else
        {
            GameObject effectIns = GameObject.Instantiate(e.emptyPlaceHolder, e.transform.position, Quaternion.Euler(0, 0, 0));

            e.debuffList.Add(new Debuff(_type, _time, _amount, effectIns));
        }
    }
Beispiel #14
0
        public static int GetActorTotalDebuff(int actorId, DebuffType countDebuffType)
        {
            int totalHpDebuffValue = 0;
            int totalSpDebuffValue = 0;

            if (DateFile.instance.ActorIsInBattle(actorId) != 0)
            {
                List <int> list = new List <int>(DateFile.instance.battleActorsInjurys[actorId].Keys);
                for (int i = 0; i < list.Count; i++)
                {
                    int injuryId    = list[i];
                    int debuffValue = ActorDebuff.GetActorDebuff(actorId, injuryId);
                    if (countDebuffType == getDebuffType(injuryId))
                    {
                        if (getDebuffSubType(injuryId) == DebuffSubType.Hp)
                        {
                            totalHpDebuffValue += debuffValue;
                        }
                        else if (getDebuffSubType(injuryId) == DebuffSubType.Sp)
                        {
                            totalSpDebuffValue += debuffValue;
                        }
                    }
                }
            }
            else
            {
                List <int> list2 = new List <int>(DateFile.instance.actorInjuryDate[actorId].Keys);
                for (int j = 0; j < list2.Count; j++)
                {
                    int injuryId    = list2[j];
                    int debuffValue = ActorDebuff.GetActorDebuff(actorId, injuryId);
                    if (countDebuffType == getDebuffType(injuryId))
                    {
                        if (getDebuffSubType(injuryId) == DebuffSubType.Hp)
                        {
                            totalHpDebuffValue += debuffValue;
                        }
                        else if (getDebuffSubType(injuryId) == DebuffSubType.Sp)
                        {
                            totalSpDebuffValue += debuffValue;
                        }
                    }
                }
            }

            return(Math.Max(totalHpDebuffValue, totalSpDebuffValue));
        }
Beispiel #15
0
        public void DurationEnable(DebuffType type, float duration)
        {
            if (_isDisabled)
            {
                return;
            }

            if (_state.State[type] == false)
            {
                _state.Enable(type);
            }

            MonoUtility.Instance.OverwritableDelaySec(duration, "Debuff" + type + _id.ToString(), () => {
                _state.Disable(type);
            });
        }
Beispiel #16
0
 private void SetDebuffType(DebuffType type)
 {
     if (_currentDebuffType == type)
     {
         return;
     }
     _currentDebuffType = type;
     if (type == DebuffType.None)
     {
         _brush.SetBrushType(CameraBrush.BrushType.Normal);
     }
     else if (type == DebuffType.Love)
     {
         SubTitleText.text = "Suddenly I miss my girlfriend who broke up a year ago...";
         SubTitleText.GetComponent <CanvasRenderer>().SetAlpha(1.0f);
         _brush.SetBrushType(CameraBrush.BrushType.Love);
     }
     else if (type == DebuffType.Game)
     {
         SubTitleText.text = "Suddenly I wanna play game... ANY game is ok...";
         SubTitleText.GetComponent <CanvasRenderer>().SetAlpha(1.0f);
         _brush.SetBrushType(CameraBrush.BrushType.Game);
     }
     else if (type == DebuffType.Sleep)
     {
         SubTitleText.text = "I fell asleep! have to escape.";
         SubTitleText.GetComponent <CanvasRenderer>().SetAlpha(1.0f);
         _brush.SetBrushType(CameraBrush.BrushType.Sleep);
     }
     else if (type == DebuffType.Noise)
     {
         SubTitleText.text = "Unwelcomed intruder comes...";
         SubTitleText.GetComponent <CanvasRenderer>().SetAlpha(1.0f);
         _brush.SetBrushType(CameraBrush.BrushType.Noise);
         PauseSleep();
         NoiseEventInstance.SetActive(true);
     }
     else if (type == DebuffType.Dance)
     {
         SubTitleText.text = "My Roommates held HELL Dancing Party....";
         SubTitleText.GetComponent <CanvasRenderer>().SetAlpha(1.0f);
         _brush.SetBrushType(CameraBrush.BrushType.Dance);
         PauseSleep();
         DanceEventInstance.SetActive(true);
     }
     Invoke("HideSubtitle", 5);
 }
Beispiel #17
0
        /// <summary>
        /// Checks special cases of debuffs - the ones that depend on some custom condition, like
        /// the debuff must be already applied when we try to apply it again.
        /// </summary>
        /// <param name="debuffType"></param>
        private void TrySetReadyForPayload(DebuffType debuffType)
        {
            IDebuff debuff;

            if (activeDebuffs.TryGetValue(debuffType, out debuff))
            {
                switch (debuffType)
                {
                case DebuffType.RuyoDamageBoost:
                    if (!debuff.IsReadyForPayload)
                    {
                        debuff.IsReadyForPayload = true;
                    }

                    break;
                }
            }
        }
Beispiel #18
0
 private void Start()
 {
     _brush                   = GetComponent <CameraBrush>();
     _currentPlayTime         = PlayTime;
     _currentReadCount        = ReadCount;
     _currentDebuffType       = DebuffType.None;
     _currentFallingSleepTime = InitialFallingSleepTime;
     _remainFallingSleepTime  = _currentFallingSleepTime;
     SetPlayTimeTxt();
     SetPercentageTxt(0);
     SetReadCountTxt(false);
     SetPaperStackThickness(PaperToReadStack, PaperToRead, _currentReadCount);
     SetPaperStackThickness(PaperCompleteStack, PaperComplete, ReadCount - _currentReadCount);
     GetComponent <VRGesture>().ShakeHandler += OnShake;
     _elapsedTime      = 0.0f;
     clockSound        = GetComponent <AudioSource>();
     clockSound.volume = 0.0f;
     _sleepPaused      = false;
 }
 //
 //Turret functions
 //
 public static void AddDebuff(Turret t, DebuffType _type, float _time, float _amount, GameObject _effect = null)
 {
     if (t.hasChildren)  //parent turrets have colliders but children don't, so the parent gives the buffs to its children
     {
         foreach (Turret child in t.childList)
         {
             AddDebuff(child, _type, _time, _amount);    //give this buff to all children, ignoring the effect
         }
     }
     //if debuff doesn't already exist or it can't be stacked, add it and if it has an effect instantiate that
     if (_effect != null)
     {
         GameObject effectIns = GameObject.Instantiate(_effect, t.transform.position, Quaternion.Euler(0, 0, 0));
         effectIns.transform.SetParent(t.transform);
         t.debuffList.Add(new Debuff(_type, _time, _amount, effectIns));
     }
     else
     {
         GameObject effectIns = GameObject.Instantiate(t.emptyPlaceHolder, t.transform.position, Quaternion.Euler(0, 0, 0));
         t.debuffList.Add(new Debuff(_type, _time, _amount, effectIns));
     }
 }
    IEnumerator RemoveBuffedStats(CharacterStats _playerStats, DebuffType _debuffType, int _buffAmount, float _duration)
    {
        yield return(new WaitForSeconds(_duration));

        // Checks if player is dead before returning the stats to it.
        if (_playerStats == null)
        {
            yield break;
        }

        switch (_debuffType)
        {
        case DebuffType.Armor:
            _playerStats.armor -= _buffAmount;
            Debug.Log(_playerStats.gameObject.name + " lost " + _buffAmount + " armor!");
            break;

        case DebuffType.AttackSpeed:
            _playerStats.attackSpeed -= _buffAmount;
            Debug.Log(_playerStats.gameObject.name + " lost " + _buffAmount + " attack speed!");
            break;

        case DebuffType.Damage:
            _playerStats.damage -= _buffAmount;
            Debug.Log(_playerStats.gameObject.name + " lost " + _buffAmount + " damage!");
            break;

        case DebuffType.ManaRegen:
            _playerStats.manaRegen -= _buffAmount;
            Debug.Log(_playerStats.gameObject.name + " lost " + _buffAmount + " mana regen!");
            break;

        case DebuffType.MaxHealth:
            _playerStats.maxHealth -= _buffAmount;
            Debug.Log(_playerStats.gameObject.name + " lost " + _buffAmount + " max health!");
            break;
        }
    }
    IEnumerator ReturnStats(CharacterStats _targetStats, DebuffType _debuffType, int _debuffAmount, float _duration)
    {
        yield return(new WaitForSeconds(_duration));

        // Checks if enemy is dead before returning the stats to it.
        if (_targetStats == null)
        {
            yield break;
        }

        switch (_debuffType)
        {
        case DebuffType.Armor:
            _targetStats.armor += _debuffAmount;
            Debug.Log(_targetStats.gameObject.name + " regained " + _debuffAmount + " armor!");
            break;

        case DebuffType.AttackSpeed:
            _targetStats.attackSpeed += _debuffAmount;
            Debug.Log(_targetStats.gameObject.name + " regained " + _debuffAmount + " attack speed!");
            break;

        case DebuffType.Damage:
            _targetStats.damage += _debuffAmount;
            Debug.Log(_targetStats.gameObject.name + " regained " + _debuffAmount + " damage!");
            break;

        case DebuffType.ManaRegen:
            _targetStats.manaRegen += _debuffAmount;
            Debug.Log(_targetStats.gameObject.name + " regained " + _debuffAmount + " mana regen!");
            break;

        case DebuffType.MaxHealth:
            _targetStats.maxHealth += _debuffAmount;
            Debug.Log(_targetStats.gameObject.name + " regained " + _debuffAmount + " max health!");
            break;
        }
    }
Beispiel #22
0
    // Effects constructor, creates an effect object and sets variables accordingly
    // Since we are creating an effect, then we are creating a zone, thus effect and zone are the same
    public Effect(EffectType effect)
    {
        this.effectType = effect;

        if (this.effectType == EffectType.Fire) {
            damage = damage * damageIncrease;
            this.debuffType = DebuffType.Burn;
        } else if (this.effectType == EffectType.Earth) {
            armour = armour * armourReduction;
            this.debuffType = DebuffType.Weaken;
        } else if (this.effectType == EffectType.Wind) {
            speed = speed * speedReduction;
            this.debuffType = DebuffType.Slow;
        } else if (this.effectType == EffectType.Ice) {
            this.debuffType = DebuffType.Slip;
        } else if (this.effectType == EffectType.None) {
            this.debuffType = DebuffType.None;
        }
        //this.setEffectSpecial(eff);
        // createZone(effectElement, towerXPos, towerZPos, width, length);
        damage = 1;
        damageIncrease = 1;
    }
    private void Debuff(object[] paras)
    {
        DebuffType type = (DebuffType)paras[0];

        ExecuteDebuff(type);
    }
Beispiel #24
0
 public DebuffFlow(IOnDebuffed target, DebuffType debuffType, float duration)
 {
     Target     = target;
     DebuffType = debuffType;
     Duration   = duration;
 }
Beispiel #25
0
 public void Instantiate(DebuffType type)
 {
     _effect.Instantiate(type);
 }
Beispiel #26
0
 public void Destroy(DebuffType type)
 {
     _effect.Destroy(type);
 }
Beispiel #27
0
 public void SetDebuffType(DebuffType debuff)
 {
     this.debuffType = debuff;
 }
Beispiel #28
0
 public void SyncDebuff(int targetViewID, DebuffType debuffType, float duration)
 {
     photonView.RPC("SyncDebuffRPC", PhotonTargets.AllViaServer, targetViewID, debuffType, duration);
 }
Beispiel #29
0
 bool HasDebuff(DebuffType debuffType)
 {
     return(m_debufList.Exists(debuff => debuff.DeBuffType == debuffType));
 }
Beispiel #30
0
 public void Register(DebuffType type, GameObject effect)
 {
     _prefab[type] = effect;
 }
Beispiel #31
0
 public void Register(DebuffType type, GameObject effect)
 {
     _state.Register(type);
     _effect.Register(type, effect);
 }