Пример #1
0
 private void EquipmentSlot_Execute(On.RoR2.EquipmentSlot.orig_Execute orig, EquipmentSlot self)
 {
     if (self.equipmentIndex == EquipmentIndex.Meteor && !CustomTarget)
     {
         PlayerToBePunished = self.characterBody;
     }
     orig(self);
 }
Пример #2
0
        private void Check(On.RoR2.EquipmentSlot.orig_Execute orig, EquipmentSlot self)
        {
            orig(self);

            if (self)
            {
                if (self.characterBody)
                {
                    if (self.characterBody.name == "PALADIN_NAME")
                    {
                        if (self.equipmentIndex == EquipmentIndex.Lightning)
                        {
                            if (base.meetsBodyRequirement)
                            {
                                base.Grant();
                            }
                        }
                    }
                }
            }
        }
        private void EquipmentSlot_Execute(On.RoR2.EquipmentSlot.orig_Execute orig, EquipmentSlot self)
        {
            var characterBody = self.characterBody;

            if (characterBody)
            {
                var inventory = characterBody.inventory;
                if (inventory && inventory.GetItemCount(catalogIndex) > 0)
                {
                    var instances = PlayerCharacterMasterController.instances;
                    foreach (PlayerCharacterMasterController playerCharacterMaster in instances)
                    {
                        //var master = playerCharacterMaster.master;
                        //var body = master.GetBody();
                        var bodyInputs = playerCharacterMaster.bodyInputs;
                        bodyInputs.skill1.PushState(true);
                        Debug.Log("Set " + playerCharacterMaster.GetDisplayName() + "'s skill1 (" + bodyInputs.skill1 + ") to " + bodyInputs.skill1.down);
                    }
                }
            }
            orig(self);
        }
Пример #4
0
        private void EquipmentSlot_Execute(On.RoR2.EquipmentSlot.orig_Execute orig, EquipmentSlot self)
        {
            if (NetworkServer.active)
            {
                var characterBody = self.characterBody;
                if (characterBody)
                {
                    var inventory = characterBody.inventory;
                    if (inventory && inventory.GetItemCount(catalogIndex) > 0)
                    {
                        var gameObject = characterBody.gameObject;
                        var inputBank  = characterBody.inputBank;
                        var master     = characterBody.master;

                        /*
                         * if (inputBank)
                         * {
                         *  var skill1 = inputBank.skill1;
                         *  var wasPressed = skill1.down;
                         *  var lastDirection = inputBank.aimDirection;
                         *  var segment = RingTriggers_Radius / Mathf.Max(RingTriggers_FireAmount,1);
                         *  master.enabled = false;
                         *  for (int i = 0; i < RingTriggers_FireAmount; i++)
                         *  {
                         *      skill1.PushState(true);
                         *      inputBank.aimDirection = new Vector3(inputBank.aimDirection.x, segment*(i+1), inputBank.aimDirection.y);
                         *  }
                         *  skill1.PushState(wasPressed);
                         *  inputBank.aimDirection = lastDirection;
                         *  master.enabled = true;
                         * }*/

                        var skillLocator = characterBody.skillLocator;
                        Debug.Log("Primary Skilltoken " + skillLocator.primary.skillNameToken);
                        if (skillLocator)
                        {
                            var primary = skillLocator.primary;
                            //var secondary = skillLocator.secondary;
                            //var utility = skillLocator.utility;
                            //var special = skillLocator.special;
                            var attackType = "";

                            var soundString = "";

                            BulletAttack bulletAttack = new BulletAttack
                            {
                                owner  = gameObject,
                                weapon = gameObject,
                                origin = inputBank.aimOrigin,
                                isCrit = Util.CheckRoll(characterBody.crit, master),
                                damage = characterBody.damage
                            };

                            OverlapAttack overlapAttack = new OverlapAttack
                            {
                                attacker  = gameObject,
                                inflictor = gameObject,
                                teamIndex = characterBody.teamComponent.teamIndex
                            };

                            FireProjectileInfo fireProjectileInfo = new FireProjectileInfo
                            {
                                owner  = gameObject,
                                crit   = Util.CheckRoll(characterBody.crit, master),
                                damage = characterBody.damage,
                                force  = 0
                            };

                            if (primary)
                            {
                                Debug.Log("Primary Skilltoken " + skillLocator.primary.skillNameToken);
                                switch (skillLocator.primary.skillNameToken)
                                {
                                case "COMMANDO_PRIMARY_NAME":     //double tap
                                    attackType                   = "bullet";
                                    bulletAttack.minSpread       = FirePistol.minSpread;
                                    bulletAttack.maxSpread       = FirePistol.maxSpread;
                                    bulletAttack.damage         *= FirePistol.damageCoefficient;
                                    bulletAttack.force           = FirePistol.force;
                                    bulletAttack.hitEffectPrefab = FirePistol.hitEffectPrefab;
                                    break;

                                case "MERC_PRIMARY_NAME":     //Laser Sword
                                    attackType = "melee";
                                    overlapAttack.damageType = DamageType.ApplyMercExpose;
                                    overlapAttack.damage     = characterBody.damage;
                                    soundString = GroundLight2.slash3Sound;
                                    break;

                                case "ENGI_PRIMARY_NAME":     //Bouncing Grenades
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = FireGrenades.projectilePrefab;
                                    fireProjectileInfo.damage          *= FireGrenades.damageCoefficient;
                                    fireProjectileInfo.force            = 0;
                                    fireProjectileInfo.target           = null;
                                    fireProjectileInfo.speedOverride    = -1;
                                    soundString = FireGrenades.attackSoundString;
                                    break;

                                case "Strafe":
                                    attackType = "orb";
                                    break;

                                case "Flurry":
                                    attackType = "orb";
                                    break;

                                case "MAGE_PRIMARY_FIRE_NAME":     //Flame Bolt
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = Resources.Load <GameObject>("prefabs/projectiles/MageFirebolt");
                                    fireProjectileInfo.damage          *= 2.2f;
                                    fireProjectileInfo.force            = 20f;
                                    break;

                                case "MAGE_PRIMARY_LIGHTNING_NAME":     //Plasma Bolt
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = Resources.Load <GameObject>("prefabs/projectiles/MageLightningboltBasic");
                                    fireProjectileInfo.damage          *= 2.2f;
                                    fireProjectileInfo.force            = 20f;
                                    break;

                                case "TOOLBOT_PRIMARY_NAME":     //Auto-Nailgun
                                    attackType = "bullet";
                                    bulletAttack.bulletCount        = 1;
                                    bulletAttack.falloffModel       = BulletAttack.FalloffModel.DefaultBullet;
                                    bulletAttack.force              = BaseNailgunState.force;
                                    bulletAttack.HitEffectNormal    = BaseNailgunState.hitEffectPrefab;
                                    bulletAttack.procChainMask      = default;
                                    bulletAttack.procCoefficient    = BaseNailgunState.procCoefficient;
                                    bulletAttack.maxDistance        = BaseNailgunState.maxDistance;
                                    bulletAttack.radius             = 0f;
                                    bulletAttack.minSpread          = 0f;
                                    bulletAttack.hitEffectPrefab    = BaseNailgunState.hitEffectPrefab;
                                    bulletAttack.maxSpread          = 0f;
                                    bulletAttack.smartCollision     = false;
                                    bulletAttack.sniper             = false;
                                    bulletAttack.tracerEffectPrefab = BaseNailgunState.tracerEffectPrefab;
                                    break;

                                case "TOOLBOT_PRIMARY_ALT1_NAME":     //Rebar Puncher
                                    attackType = "bullet";
                                    bulletAttack.stopperMask     = LayerIndex.world.mask;
                                    bulletAttack.falloffModel    = BulletAttack.FalloffModel.None;
                                    bulletAttack.hitEffectPrefab = Resources.Load <GameObject>("prefabs/effects/impacteffects/ImpactSpear");
                                    break;

                                case "TOOLBOT_PRIMARY_ALT2_NAME":     //Scrap Launcher
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = Resources.Load <GameObject>("prefabs/projectiles/ToolbotGrenadeLauncherProjectile");
                                    fireProjectileInfo.damage          *= 3.6f;
                                    break;

                                case "TOOLBOT_PRIMARY_ALT3_NAME":     //Power-Saw
                                    attackType                    = "melee";
                                    overlapAttack.damage          = FireBuzzsaw.damageCoefficientPerSecond * characterBody.damage / FireBuzzsaw.baseFireFrequency;
                                    overlapAttack.procCoefficient = FireBuzzsaw.procCoefficientPerSecond / FireBuzzsaw.baseFireFrequency;
                                    overlapAttack.hitEffectPrefab = FireBuzzsaw.impactEffectPrefab;
                                    //Transform modelTransform = characterBody.gameObject.GetModelTransform();
                                    //overlapAttack.hitBoxGroup = Array.Find<HitBoxGroup>(modelTransform.GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Buzzsaw");
                                    break;

                                case "TREEBOT_PRIMARY_NAME":     //DIRECTIVE: Inject
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = FireSyringe.finalProjectilePrefab;
                                    fireProjectileInfo.damage          *= FireSyringe.damageCoefficient;
                                    fireProjectileInfo.force            = FireSyringe.force;
                                    soundString = FireSyringe.finalAttackSound;
                                    break;

                                case "Knuckleboom":
                                    attackType = "melee";
                                    break;

                                case "Vicious Wounds":
                                    attackType = "melee";
                                    break;

                                case "CAPTAIN_PRIMARY_NAME":     //Vulcan Shotgun
                                    attackType = "bullet";
                                    bulletAttack.falloffModel    = BulletAttack.FalloffModel.DefaultBullet;
                                    bulletAttack.procCoefficient = 0.75f;
                                    bulletAttack.bulletCount     = 8;
                                    bulletAttack.damage         *= 1.2f;
                                    bulletAttack.maxSpread       = 5f;
                                    break;

                                // Enforcer //
                                case "Riot Shotgun":
                                    attackType = "bullet";
                                    break;

                                case "Super Shotgun":
                                    attackType = "bullet";
                                    break;

                                case "Assault Rifle":
                                    attackType = "bullet";
                                    break;

                                default:
                                    break;
                                }
                            }

                            switch (attackType)
                            {
                            case "bullet":
                                for (int i = 0; i < RingTriggers_FireAmount; i++)
                                {
                                    bulletAttack.origin    = characterBody.characterMotor.capsuleCollider.center;
                                    bulletAttack.aimVector = new Vector3(0, degrees * i, 0);
                                    bulletAttack.Fire();
                                    Util.PlaySound(soundString, gameObject);
                                }
                                break;

                            case "projectile":
                                for (int i = 0; i < RingTriggers_FireAmount; i++)
                                {
                                    fireProjectileInfo.position = characterBody.characterMotor.capsuleCollider.center;
                                    fireProjectileInfo.rotation = Util.QuaternionSafeLookRotation(new Vector3(0, degrees * i, 0));
                                    ProjectileManager.instance.FireProjectile(fireProjectileInfo);
                                    Util.PlaySound(soundString, gameObject);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            orig(self);
        }