Exemplo n.º 1
0
        public override void OnUnassigned([NotNull] GenericSkill skillSlot)
        {
            if (skillSlot && skillSlot.characterBody && skillSlot.characterBody.modelLocator && skillSlot.characterBody.modelLocator.modelTransform)
            {
                this.applyVisuals?.Invoke(skillSlot.characterBody.modelLocator.modelTransform.GetComponent <CharacterModel>());
            }

            EntityStateMachine[] stateMachines = skillSlot.GetComponents <EntityStateMachine>();
            foreach (StateMachineDefaults def in this.stateMachineDefaults)
            {
                foreach (EntityStateMachine mach in stateMachines)
                {
                    if (mach.customName == def.machineName)
                    {
                        mach.initialStateType = def.defaultInitalState;
                        mach.mainStateType    = def.defaultMainState;

                        if (mach.state.GetType() == def.mainState.stateType)
                        {
                            //mach.SetNextState( EntityStates.EntityState.Instantiate( def.defaultMainState ) );
                        }

                        break;
                    }
                }
            }

            base.OnUnassigned(skillSlot);
        }
Exemplo n.º 2
0
        public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
        {
            var res = base.OnAssigned(skillSlot);

            skillSlot.characterBody.levelCrit += this.critPerLevel;
            return(res);
        }
Exemplo n.º 3
0
        private void CharacterBody_OnSkillActivated(On.RoR2.CharacterBody.orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill)
        {
            orig(self, skill);
            Inventory inventory = self.inventory;

            if (inventory)
            {
                var itemCount = inventory.GetItemCount(itemDef);
                if (itemCount > 0)
                {
                    if (skill.finalRechargeInterval > 0f && skill.skillDef.stockToConsume > 0)
                    {
                        var coeff = Util.ConvertAmplificationPercentageIntoReductionPercentage(cdr + cdrPerStack * (float)(itemCount - 1)) / 100f;
                        var cooldownsReducedBy = skill.finalRechargeInterval * coeff;
                        foreach (SkillSlot skillSlot in Enum.GetValues(typeof(SkillSlot)))
                        {
                            GenericSkill otherSkill = self.skillLocator.GetSkill(skillSlot);
                            if (skill != otherSkill && otherSkill != null && otherSkill.stock < otherSkill.maxStock)
                            {
                                otherSkill.rechargeStopwatch += cooldownsReducedBy;
                            }
                        }
                        var fxHelper = self.GetComponent <MysticsItemsThoughtProcessorFXHelper>();
                        if (!fxHelper)
                        {
                            fxHelper = self.gameObject.AddComponent <MysticsItemsThoughtProcessorFXHelper>();
                        }
                        fxHelper.OnTrigger(cooldownsReducedBy);
                    }
                }
            }
        }
Exemplo n.º 4
0
 // Token: 0x060022B4 RID: 8884 RVA: 0x00096A04 File Offset: 0x00094C04
 private void Update()
 {
     if (this.hudElement.targetCharacterBody)
     {
         if (!this.skillLocator)
         {
             this.skillLocator = this.hudElement.targetCharacterBody.GetComponent <SkillLocator>();
         }
         if (this.skillLocator)
         {
             GenericSkill skill = this.skillLocator.GetSkill(this.skillSlot);
             if (skill)
             {
                 for (int i = 0; i < this.stockImages.Length; i++)
                 {
                     if (skill.stock > i)
                     {
                         this.stockImages[i].sprite = this.fullStockSprite;
                         this.stockImages[i].color  = this.fullStockColor;
                     }
                     else
                     {
                         this.stockImages[i].sprite = this.emptyStockSprite;
                         this.stockImages[i].color  = this.emptyStockColor;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
        public sealed override Sprite GetCurrentIcon(GenericSkill skillSlot)
        {
            //Log.Warning( "GetCurrentIcon" );
            var data = skillSlot.skillInstanceData as ReactivationInstanceData;

            return(data.waitingOnReactivation ? this.reactivationIcon : this.icon);
        }
Exemplo n.º 6
0
 public override SkillDef.BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
 {
     return(new NemryEnergySkillDef.InstanceData
     {
         energyComponent = skillSlot.GetComponent <NemryEnergyComponent>()
     });
 }
 // Token: 0x06001D14 RID: 7444 RVA: 0x0007C72A File Offset: 0x0007A92A
 public override SkillDef.BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
 {
     return(new HuntressTrackingSkillDef.InstanceData
     {
         huntressTracker = skillSlot.GetComponent <HuntressTracker>()
     });
 }
Exemplo n.º 8
0
 internal ScopeInstanceData(SniperScopeSkillDef scopeSkill, GenericSkill skillSlot)
 {
     this.scopeSkill = scopeSkill;
     this.zoomParams = scopeSkill.zoomParams;
     this.zoom       = this.zoomParams.defaultZoom;
     this.skillSlot  = skillSlot;
 }
 // Token: 0x06001D1A RID: 7450 RVA: 0x0007C78C File Offset: 0x0007A98C
 public override SkillDef.BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
 {
     LunarPrimaryReplacementSkill.InstanceData instanceData = new LunarPrimaryReplacementSkill.InstanceData();
     instanceData.skillSlot = skillSlot;
     skillSlot.characterBody.onInventoryChanged += instanceData.OnInventoryChanged;
     return(instanceData);
 }
        // Token: 0x06002BE3 RID: 11235 RVA: 0x000B97C4 File Offset: 0x000B79C4
        public override void OnEnter()
        {
            base.OnEnter();
            float num = this.baseDuration / this.attackSpeedStat;

            this.endTime = Run.FixedTimeStamp.now + num;
            GenericSkill primarySkill  = base.GetPrimarySkill1();
            GenericSkill primarySkill2 = base.GetPrimarySkill2();

            if (this.previousStanceState != typeof(ToolbotStanceA))
            {
                Util.Swap <GenericSkill>(ref primarySkill, ref primarySkill2);
            }
            ToolbotWeaponSkillDef toolbotWeaponSkillDef;

            if (primarySkill2 && (toolbotWeaponSkillDef = (primarySkill2.skillDef as ToolbotWeaponSkillDef)) != null)
            {
                base.SendWeaponStanceToAnimator(toolbotWeaponSkillDef);
                Util.PlaySound(toolbotWeaponSkillDef.entrySound, base.gameObject);
            }
            ToolbotWeaponSkillDef toolbotWeaponSkillDef2;

            if (primarySkill && (toolbotWeaponSkillDef2 = (primarySkill.skillDef as ToolbotWeaponSkillDef)) != null)
            {
                Debug.LogFormat("Leaving skill {0}", new object[]
                {
                    toolbotWeaponSkillDef2
                });
                base.PlayAnimation("Stance, Additive", toolbotWeaponSkillDef2.exitAnimState, "StanceSwap.playbackRate", num * 0.5f);
            }
        }
 private void OnBodySkillActivatedServer(GenericSkill skillSlot)
 {
     if (skillSlot.skillDef == this.requiredSkillDef && this.requiredSkillDef != null)
     {
         this.progress = 0;
     }
 }
Exemplo n.º 12
0
 public override SkillDef.BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
 {
     return(new PaladinRageSkillDef.InstanceData
     {
         rageComponent = skillSlot.GetComponent <PaladinRageController>()
     });
 }
        public sealed override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
        {
            EntityStateMachine reloadTargetStatemachine = null;

            EntityStateMachine[] stateMachines = skillSlot.GetComponents <EntityStateMachine>();
            for (Int32 i = 0; i < stateMachines.Length; ++i)
            {
                EntityStateMachine mach = stateMachines[i];
                if (mach.customName == this.reloadStateMachineName)
                {
                    reloadTargetStatemachine = mach;
                }
            }

#if ASSERT
            if (reloadTargetStatemachine == null)
            {
                Log.Error("No state machine found for reload");
            }
#endif

            skillSlot.stock = this.actualMaxStock;

            return(new SniperPrimaryInstanceData(this, reloadTargetStatemachine, this.reloadParams, skillSlot));
        }
Exemplo n.º 14
0
            public override void OnExecute([NotNull] GenericSkill skillSlot)
            {
                var data = skillSlot.skillInstanceData as InstanceData;

                if (data.waitingForReactivation)
                {
                    skillSlot.stateMachine.SetInterruptState(this.InstantiateNextState(skillSlot), this.reactivationInterruptPriority);
                    if (this.reactivationNoSprint)
                    {
                        skillSlot.characterBody.isSprinting = false;
                    }
                    skillSlot.stock -= this.reactivationStockToConsume;
                    if (this.reactivationRestartsCooldown)
                    {
                        skillSlot.rechargeStopwatch = 0f;
                    }
                    if (skillSlot.characterBody)
                    {
                        skillSlot.characterBody.OnSkillActivated(skillSlot);
                    }
                    data.waitingForReactivation = false;
                }
                else
                {
                    base.OnExecute(skillSlot);
                    data.waitingForReactivation  = true;
                    data.reactivationDelayTimer  = this.reactivationDelay;
                    data.reactivationWindowTimer = this.reactivationWindow;
                }
            }
Exemplo n.º 15
0
 private bool IsGrounded([NotNull] GenericSkill skillSlot)
 {
     return(skillSlot &&
            skillSlot.characterBody &&
            skillSlot.characterBody.characterMotor &&
            skillSlot.characterBody.characterMotor.isGrounded);
 }
Exemplo n.º 16
0
        private void Banditspecial(GameObject gameObject)
        {
            SkillLocator component    = gameObject.GetComponent <SkillLocator>();
            GenericSkill special      = component.special;
            GenericSkill genericSkill = gameObject.AddComponent <GenericSkill>();

            genericSkill.skillName                    = "Mortar";
            genericSkill.baseRechargeInterval         = 5f;
            genericSkill.baseMaxStock                 = 1;
            genericSkill.rechargeStock                = 1;
            genericSkill.isBullets                    = false;
            genericSkill.shootDelay                   = 0.3f;
            genericSkill.beginSkillCooldownOnSkillEnd = false;
            genericSkill.stateMachine                 = component.special.stateMachine;
            genericSkill.activationState              = new SerializableEntityStateType(typeof(EntityStates.Toolbot.AimStunDrone));
            genericSkill.interruptPriority            = InterruptPriority.Skill;
            genericSkill.isCombatSkill                = true;
            genericSkill.noSprint = false;
            genericSkill.canceledFromSprinting   = false;
            genericSkill.mustKeyPress            = true;
            genericSkill.requiredStock           = 1;
            genericSkill.stockToConsume          = 1;
            genericSkill.hasExecutedSuccessfully = false;
            genericSkill.icon = special.icon;

            Destroy(special);
            SkillManagement.SetSkill(ref genericSkill, typeof(EntityStates.Toolbot.AimStunDrone));

            component.special = genericSkill;
        }
Exemplo n.º 17
0
        public void Awake()
        {
            this.body = base.GetComponent <CharacterBody>();
            var model          = base.GetComponent <ModelLocator>();
            var modelTransform = model.modelTransform;

            this.childLocator         = modelTransform.GetComponent <ChildLocator>();
            this.rightDrillBone       = childLocator.FindChild("RightHandDrill");
            this.leftDrillBone        = childLocator.FindChild("LeftHandDrill");
            this.drillRushHitboxPivot = childLocator.FindChild("DrillRushHitboxPivot");
            this.animator             = modelTransform.GetComponent <Animator>();
            this.setStateOnHurt       = base.GetComponent <SetStateOnHurt>();
            this.skillLocator         = base.GetComponent <SkillLocator>();

            if (this.setStateOnHurt)
            {
                this.defaultCanBeFrozen     = setStateOnHurt.canBeFrozen;
                this.defaultCanBeStunned    = setStateOnHurt.canBeStunned;
                this.defaultCanBeHitStunned = setStateOnHurt.canBeHitStunned;
            }
            if (this.skillLocator)
            {
                this.yokoSkill = this.skillLocator.secondary;
            }
            On.RoR2.CharacterBody.RecalculateStats               += CharacterBody_RecalculateStats;
            On.RoR2.CharacterBody.AddBuff_BuffDef                += CharacterBody_AddBuff_BuffDef;
            On.RoR2.CharacterBody.AddTimedBuff_BuffDef_float     += CharacterBody_AddTimedBuff_BuffDef_float;
            On.RoR2.CharacterBody.AddTimedBuff_BuffDef_float_int += CharacterBody_AddTimedBuff_BuffDef_float_int;
        }
Exemplo n.º 18
0
 public static void Override(object source, GenericSkill slot, SkillDef skillDef)
 {
     if (slot != null && skillDef != null)
     {
         slot.SetSkillOverride(source, skillDef, GenericSkill.SkillOverridePriority.Replacement);
     }
 }
Exemplo n.º 19
0
        public override Sprite GetCurrentIcon([NotNull] GenericSkill skillSlot)
        {
            ElementalSkillDef.InstanceData instanceData = (ElementalSkillDef.InstanceData)skillSlot.skillInstanceData;
            int index = (instanceData != null) ? (int)instanceData.currentElement : 0;

            return(ArrayUtils.GetSafe <Sprite>(this.icons, index));
        }
Exemplo n.º 20
0
        // Token: 0x06001D28 RID: 7464 RVA: 0x0007C9B8 File Offset: 0x0007ABB8
        public override Sprite GetCurrentIcon([NotNull] GenericSkill skillSlot)
        {
            MercDashSkillDef.InstanceData instanceData = (MercDashSkillDef.InstanceData)skillSlot.skillInstanceData;
            int index = (instanceData != null) ? instanceData.currentDashIndex : 0;

            return(HGArrayUtilities.GetSafe <Sprite>(this.icons, index));
        }
Exemplo n.º 21
0
 public bool HasShield([NotNull] GenericSkill skillSlot)
 {
     //Nab the instance data
     ShieldsplosionDef.InstanceData instanceData = (ShieldsplosionDef.InstanceData)skillSlot.skillInstanceData;
     //Use the instance data to check if barrier is over 10% barrier
     return(instanceData.characterHealth && (instanceData.characterHealth.barrier >= (instanceData.characterHealth.fullHealth * 0.1f)));
 }
Exemplo n.º 22
0
 public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
 {
     return(new ElementalSkillDef.InstanceData
     {
         manipulatorTracker = skillSlot.GetComponent <ManipulatorTracker>()
     });
 }
Exemplo n.º 23
0
        /*
         * private void GenericCharacterMain_PerformInputs(On.EntityStates.GenericCharacterMain.orig_PerformInputs orig, EntityStates.GenericCharacterMain self)
         * {
         *  var hasThisItem = GeneralConfigManager.backpackEnableSkillFixes.Value && self.characterBody && self.characterBody.inventory && self.characterBody.inventory.GetItemCount(itemDef) > 0;
         *  if (hasThisItem)
         *  {
         *      for (var i = 0; i < skillDefsToFix.Count; i++)
         *      {
         *          var kvp = skillDefsToFix.ElementAt(i);
         *          skillDefsToFix[kvp.Key] = kvp.Key.mustKeyPress;
         *          kvp.Key.mustKeyPress = true;
         *      }
         *  }
         *  orig(self);
         *  if (hasThisItem)
         *  {
         *      for (var i = 0; i < skillDefsToFix.Count; i++)
         *      {
         *          var kvp = skillDefsToFix.ElementAt(i);
         *          kvp.Key.mustKeyPress = skillDefsToFix[kvp.Key];
         *      }
         *  }
         * }
         *
         * public static Dictionary<RoR2.Skills.SkillDef, bool> skillDefsToFix = new Dictionary<RoR2.Skills.SkillDef, bool>();
         *
         * private void SkillCatalog_SetSkillDefs(On.RoR2.Skills.SkillCatalog.orig_SetSkillDefs orig, RoR2.Skills.SkillDef[] newSkillDefs)
         * {
         *  orig(newSkillDefs);
         *  if (GeneralConfigManager.backpackEnableSkillFixes.Value)
         *  {
         *      var skillsToFix = new List<string>()
         *      {
         *          "ResetRevolver", "SkullRevolver",
         *          "ThrowGrenade", "ThrowStickyGrenade", "CommandoBodySweepBarrage", "CommandoBodyBarrage",
         *          "CrocoDisease",
         *          "HuntressBodyArrowRain", "FireArrowSnipe", "AimArrowSnipe",
         *          "MageBodyFlyUp", "MageBodyFlamethrower",
         *          "MercBodyEvisProjectile", "MercBodyEvis",
         *          "ToolbotDualWield", "ToolbotCancelDualWield",
         *          "LunarDetonatorSpecialReplacement"
         *      };
         *      foreach (var skillDef in newSkillDefs)
         *      {
         *          if (skillsToFix.Contains(RoR2.Skills.SkillCatalog.GetSkillName(skillDef.skillIndex)) && !skillDef.mustKeyPress)
         *          {
         *              if (!skillDefsToFix.ContainsKey(skillDef))
         *                  skillDefsToFix.Add(skillDef, false);
         *          }
         *      }
         *  }
         * }
         */

        private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, RecalculateStatsAPI.StatHookEventArgs args)
        {
            if (sender.inventory)
            {
                int itemCount = sender.inventory.GetItemCount(itemDef);
                if (itemCount > 0)
                {
                    args.cooldownMultAdd -= cdr / 100f;
                }

                var skills = new GenericSkill[]
                {
                    sender.skillLocator.primary,
                    sender.skillLocator.secondary,
                    sender.skillLocator.utility,
                    sender.skillLocator.special
                };
                foreach (var skill in skills)
                {
                    if (skill)
                    {
                        skill.SetBonusStockFromBody(0);
                    }
                }
            }
        }
Exemplo n.º 24
0
 public override SkillDef.BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
 {
     //Get the health component as instance data
     return(new ShieldsplosionDef.InstanceData
     {
         characterHealth = skillSlot.GetComponent <HealthComponent>()
     });
 }
Exemplo n.º 25
0
 private void GenericSkill_Start(On.RoR2.GenericSkill.orig_Start orig, GenericSkill self)
 {
     orig(self);
     if (self.skillDef && !self.skillDef.fullRestockOnAssign)
     {
         self.RemoveAllStocks();
     }
 }
Exemplo n.º 26
0
 // Token: 0x06001D41 RID: 7489 RVA: 0x0007CCC0 File Offset: 0x0007AEC0
 protected bool HasRequiredStockAndDelay([NotNull] GenericSkill skillSlot)
 {
     if (!this.isBullets)
     {
         return(skillSlot.stock >= this.requiredStock);
     }
     return((skillSlot.stock >= this.requiredStock && skillSlot.rechargeStopwatch >= this.shootDelay) || skillSlot.stock == skillSlot.maxStock);
 }
Exemplo n.º 27
0
 private bool HasShieldOrBarrier([NotNull] GenericSkill skillSlot)
 {
     return(skillSlot &&
            skillSlot.characterBody &&
            skillSlot.characterBody.healthComponent &&
            (skillSlot.characterBody.healthComponent.shield > 0f ||
             skillSlot.characterBody.healthComponent.barrier > 0f));
 }
Exemplo n.º 28
0
        private static bool IsInvis([NotNull] GenericSkill skillSlot)
        {
            //Grab the handler
            InvisHandler invisHandler = ((InvisOnSprintSkillDef.InstanceData)skillSlot.skillInstanceData).banditInvisHandler;

            //If it exists, check if invis, otherwise return false
            return((invisHandler != null) ? invisHandler.IsInvis() : false);
        }
Exemplo n.º 29
0
 // Token: 0x06001D46 RID: 7494 RVA: 0x0007CDFC File Offset: 0x0007AFFC
 public virtual void OnFixedUpdate([NotNull] GenericSkill skillSlot)
 {
     skillSlot.RunRecharge(Time.fixedDeltaTime);
     if (this.canceledFromSprinting && skillSlot.characterBody.isSprinting && skillSlot.stateMachine.state.GetType() == this.activationState.stateType)
     {
         skillSlot.stateMachine.SetNextStateToMain();
     }
 }
Exemplo n.º 30
0
        private static bool HasPoisoned([NotNull] GenericSkill skillSlot)
        {
            //Get the tracker
            AcridPurgeTracker acridTracker = ((AcridPurgeDef.InstanceData)skillSlot.skillInstanceData).acridTracker;

            //Returns whether or not there are any poisoned units, if none skill no worky
            return((acridTracker != null) ? acridTracker.GetPoisonedCount() >= 1 : false);
        }