public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { if (ComboStats(player)) { int bIdx = player.FindBuffIndex(buffID); if (bIdx >= 0) { if (player.buffTime[bIdx] > flurryEndDelay) { // Slowdown target if (target.velocity.Equals(default(Vector2))) { return; } target.velocity /= 2; target.netUpdate = true; } else { // Final hit PlayerFX pfx = player.GetModPlayer <PlayerFX>(); if (pfx.omHaMoShin == null) { pfx.omHaMoShin = target; pfx.omHaMoShindearuTimer = PlayerFX.omHaMoShindearuTimerMax; } else if (pfx.omHaMoShin.life < target.life) { pfx.omHaMoShin = target; pfx.omHaMoShindearuTimer = PlayerFX.omHaMoShindearuTimerMax; } } } } }
public override void RightClick(int i, int j) { //get middle bottom of tent Player player = Main.player[Main.myPlayer]; Tile tile = Main.tile[i, j]; int spawnX = i - tile.frameX / 18 + 2; int spawnY = j - tile.frameY / 18 + 2; if (tile.frameX > 90) { spawnX += 5; } //Dust.NewDust(new Vector2((float)(spawnX * 16), (float)(spawnY * 16)), 16, 16, 6, 0f, 0f, 0, default(Color), 4f); PlayerFX modPlayer = player.GetModPlayer <PlayerFX>(mod); if (modPlayer.localTempSpawn != new Vector2(spawnX, spawnY)) { Main.NewText("Temporary spawn point set!", 255, 240, 20, false); modPlayer.localTempSpawn = new Vector2(spawnX, spawnY); } else { if (player.SpawnX == -1 && player.SpawnY == -1) { Main.NewText("Temporary spawn point removed!", 255, 240, 20, false); } else { Main.NewText("Spawn point set to bed!", 255, 240, 20, false); } modPlayer.localTempSpawn = new Vector2(); } }
public override void UpdateAccessory(Player player, bool hideVisual) { PlayerFX modPlayer = player.GetModPlayer <PlayerFX>(mod); modPlayer.FrontDefence += 10; modPlayer.frontNoKnockback = true; }
public override void UpdateArmorSet(Player player) { ModPlayerFists mpf = ModPlayerFists.Get(player); PlayerFX pfx = player.GetModPlayer <PlayerFX>(); switch (armourSet) { case 1: player.setBonus = "Combo attacks deal additional damage based on enemy life"; pfx.millstone = true; pfx.patienceBuildUpModifier += 0.1f; break; case 2: player.setBonus = "Taking damage grants yin, dealing damage grants yang, \nat the end of a combo yin increases melee damage, \nyang restores a portion of missing life"; pfx.yinyang = true; break; case 3: string button = Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"); player.setBonus = "Build up momentum and double tap " + button + " to leap towards a location,\n" + "Increases running speed by 15 mph"; pfx.buildMomentum = true; pfx.momentumDash = true; player.accRunSpeed += 3f; break; } }
// Light weight, less flexible, but much safer public override bool CanUseItem(Player player) { if (PlayerFX.DualItemCanUseItemAlt(player, this, 28f / 15f, 1f, 1f, 1f)) { item.useStyle = 5; // Doesn't set for other clients normally item.UseSound = SoundID.Item8; // Doesn't play for other clients normally item.useTurn = false; item.magic = true; item.melee = false; item.noMelee = true; player.itemTime = 0; item.pick = 0; item.shoot = ProjectileID.Spark; } else { // we can take advantage of the fact that CanUseItem never gets called by // clients if it was an alt function item.useStyle = 1; item.UseSound = SoundID.Item1; item.useTurn = true; item.magic = false; item.melee = true; item.noMelee = false; player.manaCost = 0f; item.pick = 35; item.shoot = 0; // No projectile } return(true); }
public override void UpdateArmorSet(Player player) { ModPlayerFists mpf = ModPlayerFists.Get(player); PlayerFX pfx = player.GetModPlayer <PlayerFX>(); switch (armourSet) { case 1: player.setBonus = "Divekicks will steal life"; player.GetModPlayer <PlayerFX>().diveKickHeal += 0.05f; pfx.patienceBuildUpModifier += 0.2f; break; case 2: player.setBonus = Language.GetTextValue("ArmorSetBonus.Wood").Replace("1", "23") + ", damage taken is reduced by 5%,\ntemporarily reduces damage taken when not attacking"; player.statDefense += 23; player.endurance += 0.05f; pfx.yomiEndurance += 0.45f; break; case 3: player.setBonus = "Maximum life acts as a second wind, restore maximum life with combos"; pfx.secondWind = true; break; } }
public override void UpdateArmorSet(Player player) { ModPlayerFists mpf = ModPlayerFists.Get(player); PlayerFX pfx = player.GetModPlayer <PlayerFX>(); switch (armourSet) { case 1: player.setBonus = WeaponOut.GetTranslationTextValue("FistMasterHeadPower"); pfx.millstone = true; pfx.patienceBuildUpModifier += 0.1f; break; case 2: player.setBonus = WeaponOut.GetTranslationTextValue("FistMasterHeadDefence"); pfx.yinyang = true; break; case 3: string button = Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"); player.setBonus = WeaponOut.GetTranslationTextValue("FistMasterHeadSpeed").Replace("$BUTTON", button); pfx.buildMomentum = true; pfx.momentumDash = true; player.accRunSpeed += 3f; break; } }
public override void ModifyBuffTip(ref string tip, ref int rare) { PlayerFX pfx = Main.LocalPlayer.GetModPlayer <PlayerFX>(); tip = tip.Replace("$DAMAGE", "" + (int)(pfx.CalculateYinPower(pfx.GetYinYangBalance()) * 100)); }
public override void Update(Player player, ref int buffIndex) { PlayerFX pfx = player.GetModPlayer <PlayerFX>(); player.statLifeMax2 -= pfx.secondWindLifeTax; if (player.statLife > 1) { pfx.secondWindLifeTax -= player.statLife - 1; if (pfx.secondWindLifeTax < 0) { pfx.secondWindLifeTax = 0; } if (player.statLife > 5) // Must've healed I guess { if (Main.netMode == 1 && player.whoAmI == Main.myPlayer) { NetMessage.SendData(MessageID.PlayerHealth, -1, -1, null, player.whoAmI); } } } player.statLife = 1; if (pfx.secondWindLifeTax == 0) { player.ClearBuff(Type); } }
public override void UpdateArmorSet(Player player) { ModPlayerFists mpf = ModPlayerFists.Get(player); PlayerFX pfx = player.GetModPlayer <PlayerFX>(); switch (armourSet) { case 1: player.setBonus = WeaponOut.GetTranslationTextValue("ChampionLaurelsPower"); player.GetModPlayer <PlayerFX>().diveKickHeal += 0.03f; pfx.patienceBuildUpModifier += 0.2f; break; case 2: player.setBonus = WeaponOut.GetTranslationTextValue("ChampionLaurelsDefence"); player.statDefense += 23; player.endurance += 0.05f; pfx.yomiEndurance += 0.45f; break; case 3: player.setBonus = WeaponOut.GetTranslationTextValue("ChampionLaurelsSpeed"); pfx.secondWind = true; break; } }
public override void HoldItem(Player player) { // Reset style to swing when neutral if (player.itemAnimation == 0) { item.useStyle = 1; } if (player.itemTime > 0) { if (player.itemTime == 1) { PlayerFX.ItemFlashFX(player, 175); } if (player.velocity.Y == 0) { for (int i = 0; i < 3; i++) // 3 extra recharge speed { if (player.itemTime > 0) { player.itemTime--; } if (player.itemTime == 1) { PlayerFX.ItemFlashFX(player, 175); } } } } }
/// <summary> /// Called by ModPlayer in manageBodyFrame (PostUpdate) /// </summary> /// <param name="pfx"></param> public static void ParryBodyFrame(PlayerFX pfx) { Player player = pfx.player; float positiveTimeMax = pfx.parryTimeMax - pfx.parryActive; if (positiveTimeMax < 1) { positiveTimeMax = 1; } float anim = (pfx.parryTime - pfx.parryActive) / positiveTimeMax; if (anim > 0.6) { player.bodyFrame.Y = player.bodyFrame.Height * 4; } else if (anim > 0.3) { player.bodyFrame.Y = player.bodyFrame.Height * 3; } else if (anim > 0) { player.bodyFrame.Y = player.bodyFrame.Height * 2; } else { player.bodyFrame.Y = player.bodyFrame.Height * 1; } }
public override void UpdateAccessory(Player player, bool hideVisual) { PlayerFX pfx = player.GetModPlayer <PlayerFX>(); pfx.sashMaxLifeRecoverMult = Math.Max(0.25f, pfx.sashMaxLifeRecoverMult); pfx.DamageKnockbackThreshold += 20; }
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { if (AltStats(player) && !target.immortal) { player.lifeSteal += Math.Min(target.lifeMax, damage) / 4f; // Each hit restores half lifesteal potential PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / 2f); } }
public override void UpdateAccessory(Player player, bool hideVisual) { PlayerFX pfx = player.GetModPlayer <PlayerFX>(); pfx.sashMaxLifeRecoverMult = Math.Max(0.26f, pfx.sashMaxLifeRecoverMult); pfx.ghostPosition = true; player.noKnockback = true; }
// Combo public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { ModPlayerFists mpf = player.GetModPlayer <ModPlayerFists>(); if (mpf.IsComboActiveItemOnHit && !target.immortal) { PlayerFX.LifeStealPlayer(player, 1, 1, 1f); } }
protected override void Start() { base.Start(); jumpTimeCounter = jumpTime; slideTimeCounter = slideTime; Speed = 30; orgSpeed = Speed; animator = GetComponent <Animator>(); combatController = GetComponent <PlayerCombat>(); fx = GetComponent <PlayerFX>(); }
public static void NetUpdateWeaponVisual(Mod mod, PlayerFX pfx) { if (Main.netMode == 1 && pfx.player.whoAmI == Main.myPlayer) { ModPacket message = mod.GetPacket(); message.Write(3); message.Write(Main.myPlayer); message.Write(pfx.weaponVisual); message.Send(); } }
public override void UpdateAccessory(Player player, bool hideVisual) { ModPlayerFists mpf = player.GetModPlayer <ModPlayerFists>(); int diff = (localCounter - mpf.ComboCounter) / 2; if (diff > 0 && mpf.comboTimer > 0) { PlayerFX.HealPlayer(player, diff, true); } localCounter = mpf.ComboCounter; }
public override void UpdateAccessory(Player player, bool hideVisual) { player.buffImmune[BuffID.Stoned] = true; PlayerFX pFX = player.GetModPlayer <PlayerFX>(mod); if (pFX.reflectingProjectileDelay <= 0) { player.AddBuff(WeaponOut.BuffIDMirrorBarrier, 2); } }
public virtual void Start() { playerFXs = transform.GetComponent <PlayerFX> (); icon = Resources.Load <Sprite>(iconPath); spellPrefab = Resources.Load(prefabPath) as GameObject; playerAnimationManager = transform.GetComponent <PlayerAnimations> (); playerController = transform.GetComponent <PlayerController> (); player = transform.GetComponent <Player> (); spellManager = transform.GetComponent <SpellManager> (); Cursor = player.playerCursor.transform; hasBeenInitialised = true; }
// Dash & Combo public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { if (AltStats(player) && !target.immortal) { PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / 30f); } ModPlayerFists mpf = player.GetModPlayer <ModPlayerFists>(); if (mpf.IsComboActiveItemOnHit) { target.AddBuff(mod.BuffType <Buffs.ErodingWind>(), 600, false); } }
private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) { ModPlayerFists mpf = player.GetModPlayer <ModPlayerFists>(); if (mpf.parryBuff) { if (mpf.GetParryBuff() >= 0) { mpf.ClearParryBuff(); } PlayerFX.LifeStealPlayer(player, 5, 5, 1f); } }
public override void Update(Player player, ref int buffIndex) { PlayerFX pfx = player.GetModPlayer <PlayerFX>(); if (player.itemAnimation != 0 || pfx.yomiEndurance <= 0) { pfx.yomiEndurance = 0; player.ClearBuff(Type); return; } yomiEndure = (int)(pfx.yomiEndurance * 100f); player.endurance += pfx.yomiEndurance; pfx.yomiEndurance = 0; }
private void DrawInterfaceWeaponOutToggleEye(SpriteBatch spriteBatch) { // Janky quick inventory visibilty if (!Main.playerInventory || !ModConf.showWeaponOut || ModConf.forceShowWeaponOut) { return; } //Get vars PlayerFX pfx = Main.LocalPlayer.GetModPlayer <PlayerFX>(this); Texture2D eye = Main.inventoryTickOnTexture; string hoverText = "Weapon " + Lang.inter[59]; // Visible Vector2 position = new Vector2(20, 10); // Show hidden instead if (!pfx.weaponVisual) { eye = Main.inventoryTickOffTexture; hoverText = "Weapon " + Lang.inter[60]; // Hidden } // Get rectangle for eye Rectangle eyeRect = new Rectangle( (int)position.X, (int)position.Y - (eye.Height / 2), eye.Width, eye.Height); if (eyeRect.Contains(Main.mouseX, Main.mouseY)) { // Prevent item use and show text Main.hoverItemName = hoverText; Main.blockMouse = true; // On click if (Main.mouseLeft && Main.mouseLeftRelease) { Main.PlaySound(SoundID.MenuTick); pfx.weaponVisual = !pfx.weaponVisual; NetUpdateWeaponVisual(this, pfx); } } // Draw this! spriteBatch.Draw( eye, new Vector2(20, 4), null, Color.White ); }
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { ModPlayerFists mpf = player.GetModPlayer <ModPlayerFists>(); if (mpf.IsComboActiveItemOnHit) // If combo would be active when this hits { // =================== BEHAVIOURS =================== // if (!target.immortal) { PlayerFX.LifeStealPlayer(player, 3, target.lifeMax, 1f); // WeaponOut inbuilt healing code } // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // } }
public override bool CanUseItem(Player player) { if (PlayerFX.DualItemCanUseItemAlt(player, this, 1f, 1f, 1f, 0.4f)) { item.useAmmo = AmmoID.Rocket; item.shoot = ProjectileID.RocketI; } else { item.useAmmo = AmmoID.Bullet; item.shoot = ProjectileID.Bullet; } return(true); }
void Awake() { rigidbody = GetComponent <Rigidbody>(); anim = GetComponentInChildren <Animator>(); playerMesh = anim.transform; collider = GetComponent <Collider>(); defaultFriction = collider.material.dynamicFriction; crouchFriction = 0f; playerFX = GetComponentInChildren <PlayerFX>(); colliderBottom = Vector3.down * (GetComponent <CapsuleCollider>().height / 2f - 0.01f); layerMask = LayerMask.GetMask("Player"); }
public override void Update(Player player, ref int buffIndex) { PlayerFX pfx = player.GetModPlayer <PlayerFX>(); if (pfx.yinMeleeBonus <= 0f) { return; } if (player.buffTime[buffIndex] == 1) { player.buffTime[buffIndex]++; } player.meleeDamage += pfx.yinMeleeBonus; variable = (int)(pfx.yinMeleeBonus * 100f); }
/// <summary> /// /// </summary> /// <param name="player"></param> /// <param name="mod"></param> /// <param name="parryWindow"></param> /// <param name="parryCooldown">Determines time between parries. Success triples, effect lasts double</param> /// <returns></returns> public bool AtlFunctionParry(Player player, Mod mod, int parryWindow, int parryCooldown) { parryCooldownSave = parryCooldown; PlayerFX pfx = player.GetModPlayer <PlayerFX>(); if (player.itemAnimation == 0 && pfx.parryTime == 0) { pfx.parryTimeMax = parryWindow + parryCooldown; pfx.parryTime = pfx.parryTimeMax; pfx.parryActive = pfx.parryTimeMax - parryWindow; CheezeMod.NetUpdateParry(mod, pfx); return(true); } return(false); }
// Use this for initialization void Start() { shipScript = GetComponent<TutorialShipScript>(); rb = GetComponent<Rigidbody>(); pfx = GetComponent<PlayerFX>(); //playerRespawn = GetComponent<PlayerRespawn>(); tutHull = GetComponent<TutorialHull>(); tutHull.SetBuoyancy = GetComponent<TutorialBuoyancy>(); Reset(); }
// Use this for initialization void Start() { shipScript = GetComponent<ShipScript>(); rb = GetComponent<Rigidbody>(); pfx = GetComponent<PlayerFX>(); playerRespawn = GetComponent<PlayerRespawn>(); hullOnline = GetComponent<HullOnline>(); hullOnline.RB = rb; hullOnline.SetBuoyancy = GetComponent<BuoyancyScript>(); Reset(); }