Example #1
0
 public bool AddProc(Rm_ProcEffect procToAdd)
 {
     if (ProcEffect == null)
     {
         ProcEffect = procToAdd;
         return(true);
     }
     return(false);
 }
 public PassiveEffect()
 {
     CustomVariableSetters          = new List <Rm_CustomVariableGetSet>();
     CustomVariableSettersOnDisable = new List <Rm_CustomVariableGetSet>();
     StatusDurationReduction        = new List <ReduceStatusDuration>();
     AttributeBuffs    = new List <AttributeBuff>();
     VitalBuffs        = new List <VitalBuff>();
     StatisticBuffs    = new List <StatisticBuff>();
     VitalRegenBonuses = new List <VitalRegenBonus>();
     ProcEffect        = new Rm_ProcEffect();
 }
Example #3
0
 public Weapon()
 {
     Damage = new Damage()
     {
         MinDamage = 1, MaxDamage = 1
     };
     ItemType                     = ItemType.Weapon;
     OverrideAttackSpeed          = false;
     OverrideAttackRange          = false;
     OverrideProjectileSpeed      = false;
     NewAttackRange               = 2.0F;
     NewAttackSpeed               = 1.0f;
     NewProjectileSpeed           = 25.0f;
     AllowDualWield               = true;
     OverrideProjectilePrefabPath = "";
     WeaponTypeID                 = "Default_WepType";
     ProcEffect                   = new Rm_ProcEffect();
 }
        protected void HandleProc(Rm_ProcEffect procEffect, BaseCharacterMono target)
        {
            var canProc = false;

            if (procEffect.ProcCondition == Rm_ProcCondition.On_Hit)
            {
                canProc = true;
            }
            else if (procEffect.ProcCondition == Rm_ProcCondition.Chance_On_Critical_Hit ||
                     procEffect.ProcCondition == Rm_ProcCondition.Chance_On_Hit)
            {
                canProc = Random.Range(0, 100 + 1) <= (int)(procEffect.Parameter * 100);
            }
            else if (procEffect.ProcCondition == Rm_ProcCondition.Every_N_Hits)
            {
                var n = (int)procEffect.Parameter;
                canProc = procEffect.ParameterCounter % n == 0;
                Debug.Log("Proc:" + procEffect.ParameterCounter % n + " / " + n + "  " + canProc);
            }

            if (canProc)
            {
                //add actions
                if (procEffect.ProcEffectType == Rm_ProcEffectType.StatusEffect ||
                    procEffect.ProcEffectType == Rm_ProcEffectType.StatusEffectOnSelf)
                {
                    if (procEffect.ProcEffectType == Rm_ProcEffectType.StatusEffect)
                    {
                        target.Character.AddStatusEffect(procEffect.EffectParameterString);
                    }
                    else
                    {
                        if (_skill.CasterMono != null)
                        {
                            _skill.CasterMono.Character.AddStatusEffect(procEffect.EffectParameterString);
                        }
                    }
                }
                else if (procEffect.ProcEffectType == Rm_ProcEffectType.CastSkill ||
                         procEffect.ProcEffectType == Rm_ProcEffectType.CastSkillOnSelf)
                {
                    var allSkills = Rm_RPGHandler.Instance.Repositories.Skills.AllSkills;
                    var skill     = Rm_RPGHandler.Instance.Repositories.Skills.Get(procEffect.EffectParameterString);
                    if (skill != null)
                    {
                        skill.CasterMono = _skill.CasterMono;
                        skill.Caster     = _skill.Caster;

                        if (procEffect.ProcEffectType == Rm_ProcEffectType.CastSkill)
                        {
                            CastSkill(skill, target, null);
                        }
                        else
                        {
                            if (_skill.CasterMono != null)
                            {
                                CastSkill(skill, _skill.CasterMono, null);
                            }
                        }
                    }
                }
                else if (procEffect.ProcEffectType == Rm_ProcEffectType.KnockBack)
                {
                    target.Controller.AddImpact(Direction.Back, procEffect.EffectParameter);
                }
                else if (procEffect.ProcEffectType == Rm_ProcEffectType.KnockUp)
                {
                    target.Controller.AddImpact(Direction.Up, procEffect.EffectParameter);
                }
                else if (procEffect.ProcEffectType == Rm_ProcEffectType.PullTowards)
                {
                    var pullposition = transform.position;
                    pullposition.y = target.transform.position.y;
                    target.Controller.PullTo(pullposition, procEffect.PullAllTheWay ? -1 : procEffect.EffectParameter);
                }
            }
        }
 public void AddProcEffect(Rm_ProcEffect procEffect)
 {
     ProcEffects.Add(procEffect);
     //FullUpdateStats();
 }