public override void InheritData(Gun source) { base.InheritData(source); SoulOrbController component = source.GetComponent <SoulOrbController>(); if (component != null) { this.charges = component.charges; this.damageToGoUp = component.damageToGoUp; } }
public static void Init() { Gun gun = ETGMod.Databases.Items.NewGun("Soul Orb", "soul_orb"); Game.Items.Rename("outdated_gun_mods:soul_orb", "spapi:soul_orb"); SoulOrbController component = gun.gameObject.AddComponent <SoulOrbController>(); GunExt.SetShortDescription(gun, "Contains SOUL"); GunExt.SetLongDescription(gun, "Charges up. Firing consumes 3 charges and casts a powerful spell. Reloading swaps the spell and holding \"reload\" consumes 3 charge to heal the owner.\n\nSOUL is the essence of life in a far away kingdom. " + "It somehow works here too, even through gundead do not contain it."); GunExt.SetupSprite(gun, null, "soul_orb_idle_001", 8); GunExt.SetAnimationFPS(gun, gun.shootAnimation, 16); GunExt.AddProjectileModuleFrom(gun, "klobb", true, false); gun.DefaultModule.shootStyle = ProjectileModule.ShootStyle.SemiAutomatic; gun.DefaultModule.angleVariance = 0; gun.SetBaseMaxAmmo(1); gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.MEDIUM_BULLET; Projectile oldProjectile = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(47) as Gun).DefaultModule.projectiles[0]); SoulProjectileBehaviour projectile = Toolbox.CopyFields <SoulProjectileBehaviour>(oldProjectile); Destroy(oldProjectile); projectile.gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(projectile.gameObject); UnityEngine.Object.DontDestroyOnLoad(projectile); gun.DefaultModule.projectiles[0] = projectile; projectile.transform.parent = gun.barrelOffset; projectile.AnimateProjectile(new List <string> { "vs_001", "vs_002", "vs_003", "vs_004", "vs_005" }, 16, true, new List <IntVector2> { new IntVector2(30, 12), new IntVector2(30, 12), new IntVector2(26, 12), new IntVector2(27, 14), new IntVector2(29, 12) }, Toolbox.ConstructListOfSameValues(true, 5), Toolbox.ConstructListOfSameValues(tk2dBaseSprite.Anchor.MiddleCenter, 5), Toolbox.ConstructListOfSameValues(true, 5), Toolbox.ConstructListOfSameValues(true, 5), Toolbox.ConstructListOfSameValues <Vector3?>(null, 5), Toolbox.ConstructListOfSameValues <IntVector2?>(null, 5), Toolbox.ConstructListOfSameValues <IntVector2?>(null, 5), Toolbox.ConstructListOfSameValues <Projectile>(null, 5)); gun.DefaultModule.cooldownTime = 0f; component.preventNormalFireAudio = true; component.overrideNormalFireAudio = "Play_WPN_bsg_shot_01"; projectile.AdditionalScaleMultiplier = 2f; projectile.hitEffects = Toolbox.GetGunById(417).DefaultModule.projectiles[0].hitEffects; projectile.ignoreDamageCaps = true; projectile.baseData.damage = 100f; gun.InfiniteAmmo = true; gun.DefaultModule.numberOfShotsInClip = 1; gun.reloadTime = 0f; gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.CUSTOM; gun.DefaultModule.customAmmoType = "white"; gun.quality = PickupObject.ItemQuality.S; gun.barrelOffset.transform.localPosition = new Vector3(1.7f, 0.65f, 0f); gun.encounterTrackable.EncounterGuid = "soul_orb"; gun.gunClass = GunClass.PISTOL; ETGMod.Databases.Items.Add(gun, null, "ANY"); gun.AddToTrorkShop(); gun.AddToBlacksmithShop(); gun.RemovePeskyQuestionmark(); gun.PlaceItemInAmmonomiconAfterItemById(22); SoulFocusVFX = (PickupObjectDatabase.GetById(538) as SilverBulletsPassiveItem).SynergyPowerVFX; }