Esempio n. 1
0
        private bool attachBuffPassive(Unit target)
        {
            if (target == null)
            {
                return(false);
            }
            bool flag = false;

            using (List <BuffEffect> .Enumerator enumerator = this.mBuffEffectLists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BuffEffect current = enumerator.Current;
                    if (current != null && current.param.chk_timing == EffectCheckTimings.Eternal && current.CheckEnableBuffTarget(target))
                    {
                        BaseStatus status1 = new BaseStatus();
                        BaseStatus status2 = new BaseStatus();
                        BaseStatus status3 = new BaseStatus();
                        BaseStatus status4 = new BaseStatus();
                        current.CalcBuffStatus(ref status1, BuffTypes.Buff, SkillParamCalcTypes.Add);
                        current.CalcBuffStatus(ref status2, BuffTypes.Buff, SkillParamCalcTypes.Scale);
                        current.CalcBuffStatus(ref status3, BuffTypes.Debuff, SkillParamCalcTypes.Add);
                        current.CalcBuffStatus(ref status4, BuffTypes.Debuff, SkillParamCalcTypes.Scale);
                        if (current.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Buff, SkillParamCalcTypes.Add, status1);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Scale))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Buff, SkillParamCalcTypes.Scale, status2);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Debuff, SkillParamCalcTypes.Add, status3);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Scale))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Debuff, SkillParamCalcTypes.Scale, status4);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        flag = true;
                    }
                }
            }
            return(flag);
        }
Esempio n. 2
0
        private bool actionBuff(Unit target, EffectCheckTimings chk_timing, RandXorshift rand = null)
        {
            if (this.mBuffEffect == null || target == null || !this.mBuffEffect.CheckEnableBuffTarget(target))
            {
                return(false);
            }
            if (rand != null)
            {
                int rate = (int)this.mBuffEffect.param.rate;
                if (0 < rate && rate < 100 && (int)(rand.Get() % 100U) > rate)
                {
                    return(true);
                }
            }
            BaseStatus status1 = new BaseStatus();
            BaseStatus status2 = new BaseStatus();
            BaseStatus status3 = new BaseStatus();
            BaseStatus status4 = new BaseStatus();

            this.mBuffEffect.CalcBuffStatus(ref status1, BuffTypes.Buff, SkillParamCalcTypes.Add);
            this.mBuffEffect.CalcBuffStatus(ref status2, BuffTypes.Buff, SkillParamCalcTypes.Scale);
            this.mBuffEffect.CalcBuffStatus(ref status3, BuffTypes.Debuff, SkillParamCalcTypes.Add);
            this.mBuffEffect.CalcBuffStatus(ref status4, BuffTypes.Debuff, SkillParamCalcTypes.Scale);
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, SkillParamCalcTypes.Add, status1, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Scale))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, SkillParamCalcTypes.Scale, status2, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, SkillParamCalcTypes.Add, status3, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Scale))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, SkillParamCalcTypes.Scale, status4, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            return(true);
        }
Esempio n. 3
0
        public void ExecuteGimmickEffect(Unit gimmick, Unit target, LogMapEvent log = null)
        {
            switch (this.GimmickType)
            {
            case EEventGimmick.Heal:
                int num = 0;
                if (!target.IsUnitCondition(EUnitCondition.DisableHeal))
                {
                    int hp  = (int)target.MaximumStatus.param.hp;
                    int val = hp * this.IntValue / 100;
                    num = Math.Min(target.CalcParamRecover(val), hp - (int)target.CurrentStatus.param.hp);
                }
                target.Heal(num);
                if (log == null)
                {
                    break;
                }
                log.heal = num;
                break;

            case EEventGimmick.AtkUp:
            case EEventGimmick.DefUp:
            case EEventGimmick.MagUp:
            case EEventGimmick.MndUp:
            case EEventGimmick.RecUp:
            case EEventGimmick.SpdUp:
            case EEventGimmick.CriUp:
            case EEventGimmick.LukUp:
            case EEventGimmick.MovUp:
                BuffAttachment buff = this.MakeBuff(gimmick, target);
                target.SetBuffAttachment(buff, false);
                if (log == null)
                {
                    break;
                }
                BattleCore.SetBuffBits(buff.status, ref log.buff, ref log.debuff);
                break;
            }
        }
Esempio n. 4
0
        public void ExecuteGimmickEffect(Unit gimmick, Unit target, LogMapEvent log = null)
        {
            switch (this.GimmickType)
            {
            case EEventGimmick.Heal:
                int hp  = (int)target.MaximumStatus.param.hp;
                int num = Math.Min(hp * this.IntValue / 100, hp - (int)target.CurrentStatus.param.hp);
                target.Heal(num);
                if (log == null)
                {
                    break;
                }
                log.heal = num;
                break;

            case EEventGimmick.AtkUp:
            case EEventGimmick.DefUp:
            case EEventGimmick.MagUp:
            case EEventGimmick.MndUp:
            case EEventGimmick.RecUp:
            case EEventGimmick.SpdUp:
            case EEventGimmick.CriUp:
            case EEventGimmick.LukUp:
            case EEventGimmick.MovUp:
                BuffAttachment      buff                = new BuffAttachment();
                FixParam            fixParam            = MonoSingleton <GameManager> .Instance.MasterParam.FixParam;
                int                 gemsBuffValue       = (int)fixParam.GemsBuffValue;
                int                 gemsBuffTurn        = (int)fixParam.GemsBuffTurn;
                SkillParamCalcTypes skillParamCalcTypes = SkillParamCalcTypes.Scale;
                if (this.GimmickType == EEventGimmick.AtkUp)
                {
                    buff.status.param.atk = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.DefUp)
                {
                    buff.status.param.def = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.MagUp)
                {
                    buff.status.param.mag = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.MndUp)
                {
                    buff.status.param.mnd = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.RecUp)
                {
                    buff.status.param.rec = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.SpdUp)
                {
                    buff.status.param.spd = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.CriUp)
                {
                    buff.status.param.cri = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.LukUp)
                {
                    buff.status.param.luk = (OShort)gemsBuffValue;
                }
                if (this.GimmickType == EEventGimmick.MovUp)
                {
                    buff.status.param.mov = (OShort)2;
                    skillParamCalcTypes   = SkillParamCalcTypes.Add;
                }
                buff.user         = gimmick;
                buff.BuffType     = BuffTypes.Buff;
                buff.CalcType     = skillParamCalcTypes;
                buff.CheckTarget  = target;
                buff.CheckTiming  = EffectCheckTimings.ActionStart;
                buff.UseCondition = ESkillCondition.None;
                buff.IsPassive    = (OBool)false;
                buff.turn         = (OInt)gemsBuffTurn;
                target.SetBuffAttachment(buff, false);
                if (log == null)
                {
                    break;
                }
                BattleCore.SetBuffBits(buff.status, ref log.buff, ref log.debuff);
                break;
            }
        }