예제 #1
0
        private void ApplyHealing(HealthComponent healthComponent, CharacterBody body = null)
        {
            bool  embryoProc = Embryo.instance.CheckEmbryoProc(body);
            float restore    = healthRestoreAmount;

            if (embryoProc)
            {
                restore *= 2f;
            }
            if (!body)
            {
                body = healthComponent.body;
            }
            if (healType == 0)
            {
                healthComponent.HealFraction(restore, default);
            }
            else
            {
                healthComponent.Heal(restore, default);
            }
            if (enableRegenBuff)
            {
                body.AddTimedBuff(regenBuff, regenDuration);
                if (embryoProc)
                {
                    body.AddTimedBuff(regenBuff, regenDuration);
                }
            }
        }
예제 #2
0
    public void HealingGraceAbility()
    {
        float healAmount = _healthComp.maxHealth / 2;

        _healthComp.Heal(healAmount);
        print("Healing grace");
    }
 // Token: 0x06001D6A RID: 7530 RVA: 0x0007D540 File Offset: 0x0007B740
 public override void OnArrival()
 {
     if (this.target)
     {
         HealthComponent healthComponent = this.target.healthComponent;
         if (healthComponent)
         {
             if (this.damageOrbType == DamageOrb.DamageOrbType.ClayGooOrb)
             {
                 CharacterBody component = healthComponent.GetComponent <CharacterBody>();
                 if (component && (component.bodyFlags & CharacterBody.BodyFlags.ImmuneToGoo) != CharacterBody.BodyFlags.None)
                 {
                     healthComponent.Heal(this.damageValue, default(ProcChainMask), true);
                     return;
                 }
             }
             DamageInfo damageInfo = new DamageInfo();
             damageInfo.damage           = this.damageValue;
             damageInfo.attacker         = this.attacker;
             damageInfo.inflictor        = null;
             damageInfo.force            = Vector3.zero;
             damageInfo.crit             = this.isCrit;
             damageInfo.procChainMask    = this.procChainMask;
             damageInfo.procCoefficient  = this.procCoefficient;
             damageInfo.position         = this.target.transform.position;
             damageInfo.damageColorIndex = this.damageColorIndex;
             damageInfo.damageType       = this.orbDamageType;
             healthComponent.TakeDamage(damageInfo);
             GlobalEventManager.instance.OnHitEnemy(damageInfo, healthComponent.gameObject);
             GlobalEventManager.instance.OnHitAll(damageInfo, healthComponent.gameObject);
         }
     }
 }
예제 #4
0
 public void OnReceived()
 {
     _target.Heal(_adjustedCount * ShootToHeal.instance.healAmount, _pcm);
     if (_self)
     {
         _self.Heal(_adjustedCount * ShootToHeal.instance.returnHealingAmount, _pcm);
     }
 }
예제 #5
0
 IEnumerator Healing()
 {
     while (_canHeal)
     {
         _playerHealthComp.Heal(_healAmount);
         print("Heal");
         yield return(new WaitForSeconds(0.025f));
     }
 }
예제 #6
0
    private void OnTriggerEnter(Collider other)
    {
        HealthComponent hpComponent = other.GetComponent <HealthComponent>();

        if (usableBy == Team.All || hpComponent && hpComponent.currentTeam == usableBy)
        {
            hpComponent.Heal(1);
            OnCollected();
        }
    }
예제 #7
0
 protected override void OnWhileActive(ToolController owner, GameObject target)
 {
     if (NextUpdateTime <= Time.time)
     {
         healthComponent.Heal(HealthPerCycle);
         inventoryComponent.RemoveResource(RepairNaniteResource, NanitesPerCycle);
         Debug.Log("Repairing Target");
         Debug.Log(healthComponent.Health);
         NextUpdateTime += CycleInterval;
     }
 }
예제 #8
0
 // Token: 0x06001D43 RID: 7491 RVA: 0x000886F8 File Offset: 0x000868F8
 public override void OnArrival()
 {
     if (this.target)
     {
         HealthComponent healthComponent = this.target.healthComponent;
         if (healthComponent)
         {
             healthComponent.Heal(this.healValue, default(ProcChainMask), true);
         }
     }
 }
예제 #9
0
 // Token: 0x06001D46 RID: 7494 RVA: 0x000887DC File Offset: 0x000869DC
 public override void OnArrival()
 {
     if (this.targetInventory)
     {
         this.targetInventory.AddInfusionBonus((uint)this.maxHpValue);
         HurtBox         component       = this.target.GetComponent <HurtBox>();
         HealthComponent healthComponent = (component != null) ? component.healthComponent : null;
         if (healthComponent)
         {
             healthComponent.Heal((float)this.maxHpValue, default(ProcChainMask), true);
         }
     }
 }
            public void OnReceived()
            {
                GameObject      gameObject      = Util.FindNetworkObject(this.targetId);
                HealthComponent healthComponent = gameObject.GetComponent <HealthComponent>();

                if (!gameObject)
                {
                    StanWorshipperPlugin.logger.LogMessage("Error syncing heal: target id not found!");
                    return;
                }

                healthComponent.Heal(healthComponent.fullHealth * mult, default(ProcChainMask));
            }
예제 #11
0
        private void OnTriggerEnter(Collider other)
        {
            // hit by obstacle, receive damage (except: god mode enabled)
            if (other.gameObject.CompareTag("Obstacle") && !_playerModel.DebugGodMode)
            {
                _health.Damage();
            }

            // hit by health pack, heal
            if (other.gameObject.CompareTag("HealthPack"))
            {
                _health.Heal();
            }
        }
예제 #12
0
        private static void RandomizeDamage(On.RoR2.HealthComponent.orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
        {
            float rand = RandomFloat();

            if (rand < 0)
            {
                // heal instead
                self.Heal(-rand * damageInfo.damage, default);
            }
            else
            {
                damageInfo.damage = (float)Math.Ceiling(damageInfo.damage * rand);
                orig(self, damageInfo);
            }
        }
예제 #13
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.layer == 10 && canDashDamage && collision.GetComponentInParent <HealthComponent>() != null && collision.GetComponentInParent <EnemyController>() != null)
        {
            //if damage from dash is enabled i.e. we can "see" the enemy
            if (collision.GetComponentInParent <EnemyController>().canRecieveDamage)
            {
                enemyHealthComp = collision.GetComponentInParent <HealthComponent>();
                playerHealthComp.Heal(dashHealAmount);
                enemyHealthComp.Damage(dashDamage * playerController.DamageMultiplier);
            }


            uiManager.UpdateHealthSlider();
            //_uiManager.DamageHealthBar();
        }
    }
        private void TankHit(On.RoR2.HealthComponent.orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
        {
            var InventoryCount = GetCount(self.body);
            //var actualHealAmount = self.fullHealth * (HealAmount + (HealAmountStack * (InventoryCount - 1)));
            var actualHealAmount = HealAmount + HealAmountStack * (InventoryCount - 1);

            if (InventoryCount > 0)
            {
                if (!damageInfo.rejected)
                {
                    if (self.health - damageInfo.damage > 0) //Is your expected health loss greater than zero?
                    {                                        //nonfatal
                        if (Util.CheckRoll(HealChance))
                        {                                    //success
                            Chat.AddMessage("GreenGuon: NONLETHAL SUCCESS");
                            damageInfo.rejected = true;
                            self.Heal(actualHealAmount, default, true);
예제 #15
0
        public override void Effect(GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject victim, int itemCount)
        {
            CharacterBody body     = damageInfo.attacker.GetComponent <CharacterBody>();
            CharacterBody Attacker = damageInfo.attacker.GetComponent <CharacterBody>();

            Inventory inventory = body.master.inventory;

            if (itemCount > 0)
            {
                HealthComponent AttackerHealthComponent = Attacker.GetComponent <HealthComponent>();
                if (AttackerHealthComponent)
                {
                    ProcChainMask procChainMask = damageInfo.procChainMask;
                    procChainMask.SetProcValue(ProcType.HealOnHit, true);
                    double num = AttackerHealthComponent.Heal(itemCount * damageInfo.procCoefficient, procChainMask, true);
                }
            }
        }
예제 #16
0
        private static void LeechHook()
        {
            On.RoR2.EquipmentSlot.PerformEquipmentAction += (orig, self, equipmentIndex) =>
            {
                if (equipmentIndex == MassiveLeechIndex)
                {
                    if (self.characterBody)
                    {
                        self.characterBody.AddTimedBuff(MassiveLeechbuff, 10f);
                        return(true);
                    }
                }
                return(orig(self, equipmentIndex));
            };

            On.RoR2.GlobalEventManager.OnHitEnemy += (orig, self, damage, victim) =>
            {
                if (damage.attacker)
                {
                    CharacterBody   Attacker       = damage.attacker.GetComponent <CharacterBody>();
                    CharacterMaster AttackerMaster = Attacker.master;
                    if (Attacker && AttackerMaster)
                    {
                        if (Attacker.HasBuff(MassiveLeechbuff))
                        {
                            ProcChainMask   procChainMask = damage.procChainMask;
                            HealthComponent component     = Attacker.GetComponent <HealthComponent>();
                            procChainMask.AddProc(ProcType.HealOnHit);
                            float heal = Attacker.level + 10f;
                            component.Heal(heal * damage.procCoefficient, procChainMask, true);
                        }
                    }
                }
                orig(self, damage, victim);
            };
        }
예제 #17
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject.tag == "Player")
        {
            InventorySystem Inventory = (collider.gameObject.GetComponent <PlayerController>()).Inventory;
            if (Inventory)
            {
                SoundSource.PlayOneShot(PickUpSound, 0.5f);
                switch (itemType)
                {
                case InventoryItem.ItemType.kItemTypeWeapon:
                {
                    Inventory.GrabItem(this);
                    bShouldDestroy = true;
                    gameObject.GetComponent <BoxCollider>().enabled = false;
                    gameObject.transform.GetChild(0).gameObject.SetActive(false);
                }
                break;

                case InventoryItem.ItemType.kItemTypeAmmo:
                {
                    for (int i = 0; i < 3; ++i)
                    {
                        Weapon w =
                            (Weapon)Inventory.GetInventoryItemByIndex(InventoryItem.ItemType.kItemTypeWeapon, i);
                        if (w)
                        {
                            w.RecoverAmmo(w.MaxAmmo / 3);
                        }
                    }
                    bShouldDestroy = true;
                    gameObject.GetComponent <BoxCollider>().enabled = false;
                    gameObject.transform.GetChild(0).gameObject.SetActive(false);
                }
                break;

                case InventoryItem.ItemType.kItemTypeHP:
                {
                    HealthComponent health = collider.gameObject.GetComponent <HealthComponent>();
                    if (health)
                    {
                        health.Heal(HealAmount);
                    }
                    bShouldDestroy = true;
                    gameObject.GetComponent <BoxCollider>().enabled = false;
                    gameObject.transform.GetChild(0).gameObject.SetActive(false);
                }
                break;

                case InventoryItem.ItemType.kItemTypeArmour:
                {
                    HealthComponent health = collider.gameObject.GetComponent <HealthComponent>();
                    if (health)
                    {
                        health.RestoreArmor(ArmorAmount);
                    }
                    bShouldDestroy = true;
                    gameObject.GetComponent <BoxCollider>().enabled = false;
                    gameObject.transform.GetChild(0).gameObject.SetActive(false);
                }
                break;

                case InventoryItem.ItemType.kItemTypePowerUp:
                {
                    PlayerController PC = collider.gameObject.GetComponent <PlayerController>();
                    PC.jumpFix    += JumpForceAmount;
                    bShouldDestroy = true;
                    gameObject.GetComponent <BoxCollider>().enabled = false;
                    gameObject.transform.GetChild(0).gameObject.SetActive(false);
                }
                break;

                case InventoryItem.ItemType.kItemTypeKey:
                {
                    Inventory.GrabItem(this);
                    gameObject.GetComponent <BoxCollider>().enabled = false;
                    gameObject.transform.GetChild(0).gameObject.SetActive(false);
                    gameObject.transform.SetParent(Inventory.transform);
                }
                break;
                }
            }
        }
    }
예제 #18
0
 public void Reset()
 {
     HealthComponent.Heal(HealthComponent.MaximumHealth);
 }
 public void Heal(int amount)
 {
     healthComp.Heal(amount);
 }
예제 #20
0
 public void Awake()
 {
     ReadConfig();
     On.RoR2.CharacterBody.RecalculateStats += (orig, self) =>
     {
         orig(self);
         if (self.HasBuff(RoR2Content.Buffs.Warbanner))
         {
             //I have really no idea how to set this without reflection
             //From other plugins I've seen they were able to do it without reflection
             //If anyone knows how I'd be very grateful if they'd share that with me
             PropertyInfo propertyinfo;
             if (self.moveSpeed > 0f)
             {
                 if (MoveSpeedBonus.Value > 0f)
                 {
                     //Add the movement speed
                     propertyinfo = self.GetType().GetProperty("moveSpeed");
                     propertyinfo.SetValue(self, self.moveSpeed + MoveSpeedBonus.Value, null);
                     //Correct the acceleration
                     propertyinfo = self.GetType().GetProperty("acceleration");
                     propertyinfo.SetValue(self, self.moveSpeed / self.baseMoveSpeed * self.baseAcceleration, null);
                 }
             }
             //Add attack speed
             if (AttackSpeedBonus.Value != 0f)
             {
                 propertyinfo = self.GetType().GetProperty("attackSpeed");
                 propertyinfo.SetValue(self, self.attackSpeed + AttackSpeedBonus.Value, null);
             }
             //Add crit
             if (CritBonus.Value != 0f)
             {
                 propertyinfo = self.GetType().GetProperty("crit");
                 propertyinfo.SetValue(self, self.crit + CritBonus.Value, null);
             }
             //Add armor
             if (ArmorBonus.Value != 0f)
             {
                 propertyinfo = self.GetType().GetProperty("armor");
                 propertyinfo.SetValue(self, self.armor + ArmorBonus.Value, null);
             }
             //Add damage
             if (DamageBonus.Value != 0f)
             {
                 propertyinfo = self.GetType().GetProperty("damage");
                 propertyinfo.SetValue(self, self.damage + DamageBonus.Value, null);
             }
         }
     };
     On.RoR2.Run.Start += (orig, self) =>
     {
         orig(self);
         HealInterval = 1f;
     };
     On.RoR2.Run.FixedUpdate += (orig, self) =>
     {
         orig(self);
         if (RegenTick.Value > 0f)
         {
             if (HealInterval <= 0f)
             {
                 HealInterval += RegenTick.Value;
             }
             HealInterval -= Time.fixedDeltaTime;
         }
     };
     On.RoR2.CharacterBody.FixedUpdate += (orig, self) =>
     {
         orig(self);
         if (RegenTick.Value > 0f && HealInterval <= 0f)
         {
             if (self.HasBuff(RoR2Content.Buffs.Warbanner))
             {
                 HealthComponent healthComponent = self.healthComponent;
                 if (healthComponent)
                 {
                     float healing = healthComponent.fullHealth * RegenMaxHealth.Value;
                     healing += RegenLevelHealth.Value * self.level;
                     if (healing < RegenMin.Value)
                     {
                         healing = RegenMin.Value;
                     }
                     if (healing > 0f)
                     {
                         healthComponent.Heal(healing, default, true);