public void ItemSelected() { itemType = item.ToString(); if (itemType == TypeOfItem.Helmets.ToString()) { helmet = inventory.InventoryExtensions.FindHelmet(objectId); inventoryManager.updatePlayerHelmet(helmet); } else if (itemType == TypeOfItem.Arms.ToString()) { arm = inventory.InventoryExtensions.FindArm(objectId); inventoryManager.updatePlayerArm(arm); } else if (itemType == TypeOfItem.Chests.ToString()) { chest = inventory.InventoryExtensions.FindChest(objectId); inventoryManager.updatePlayerChest(chest); } else if (itemType == TypeOfItem.Legs.ToString()) { leg = inventory.InventoryExtensions.FindLeg(objectId); inventoryManager.updatePlayerLeg(leg); } else if (itemType == TypeOfItem.WeaponAttacks.ToString()) { attack = inventory.InventoryExtensions.FindWeaponAttack(objectId); inventoryManager.updatePlayerComboSet(attack); } else if (itemType == TypeOfItem.OneHandedWeapons.ToString()) { oneHandedWeapon = inventory.InventoryExtensions.FindOneHandedWeapon(objectId); inventoryManager.updatePlayerOneHandedWeapon(oneHandedWeapon); } else if (itemType == TypeOfItem.TwoHandedWeapons.ToString()) { twoHandedWeapon = inventory.InventoryExtensions.FindTwoHandedWeapon(objectId); inventoryManager.updatePlayerTwoHandedWeapon(twoHandedWeapon); } Debug.Log("Item added!"); }
public void ResetTwoHandedEffects() { if (player.controlUseItem) { if (LeftClickTimer < 240) { LeftClickTimer++; } } else { TwoHanderChargeAttack = false; LeftClickTimer = 0; } if (IsSwinging && LeftClickTimer >= 20 && !WindedBack) { WindedBack = false; TwoHanderChargeAttack = true; IsSwinging = false; DownwardsSlash = false; } if (IsSwinging && SwingRotation < 4.5f) { if (SwingRotation > 4.5f) { SwingRotation = 4.5f; } if (!WindedBack) { if (SwingRotation > -0.4f) { SwingRotation -= 0.02f; } else { WindedBack = true; } } else if (SwingRotation < 0.2f) { SwingRotation += 0.05f; } else { SwingRotation *= 1.25f; } if (SwingRotation > 3.0f) { Projectile.NewProjectile(player.Center, new Vector2(0.5f * player.direction, -0.5f), ModContent.ProjectileType <TwoHandedWeaponHitbox>(), player.HeldItem.damage, player.HeldItem.knockBack * 2f, player.whoAmI); Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 71); } } else if (DownwardsSlash && SwingRotation > 2.0f) { IsSlashReversed = true; WaitTimer = 2.4f; if (!WindedBack) { if (SwingRotation < 4.68f) { SwingRotation += 0.01f; } else { WindedBack = true; } } else { SwingRotation *= 0.875f; if (SwingRotation <= 2.0f) { Projectile.NewProjectile(player.Center, new Vector2(1 * player.direction, -0.5f), ModContent.ProjectileType <TwoHandedWeaponHitbox>(), player.HeldItem.damage, player.HeldItem.knockBack * 1.5f, player.whoAmI); Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 71); } } } else if (WaitTimer <= 0.0f && !TwoHanderChargeAttack) { IsSlashReversed = false; DownwardsSlash = false; WindedBack = false; IsSwinging = false; if (SwingRotation > 0.2f) { if (SwingRotation > 4.45f) { SwingRotation *= 0.999f; } else { SwingRotation *= 0.95f; } } else { SwingRotation = 0.0f; } } if (!HoldsTwoHander) { HasIgnitedStick = false; IsSlashReversed = false; DownwardsSlash = false; WindedBack = false; IsSwinging = false; SwingRotation = 0.0f; } if (WaitTimer > 0.0f) { if (WaitTimer < 2.4f) { DownwardsSlash = false; } WaitTimer -= 0.1f; } if (HoldsTwoHander) { TwoHandedWeapon weapon = player.HeldItem.modItem as TwoHandedWeapon; if (Main.myPlayer == player.whoAmI) { weapon?.DrawEffects(player); } } if (TwoHanderChargeAttack) { if (LeftClickTimer == 20) { Projectile.NewProjectile(player.Center, new Vector2(1 * player.direction, -0.5f), ModContent.ProjectileType <TwoHandedWeaponHitbox>(), player.HeldItem.damage, player.HeldItem.knockBack * 1.5f, Main.myPlayer); } if (SwingRotation <= -6.28) { SwingRotation = 0.0f; } SwingRotation -= LeftClickTimer * 0.001f; _exhaustedTimer = 30; SpendRate += 0.18f; IsSlashReversed = true; } if (Exhausted) { TwoHanderChargeAttack = false; } }
// Method to update player's twoHandedWeapon public void updatePlayerTwoHandedWeapon(TwoHandedWeapon w) { playerManager.CurrentTwoHandedWeapon = w; }
// Method to find an specific Two Handed Weapon public TwoHandedWeapon FindTwoHandedWeapon(int twoHandedWeaponId) { TwoHandedWeapon twoHandedWeapon = (TwoHandedWeapon)FindInventoryItem(inv.WeaponsKey, inv.Weapons.TwoHandedWeaponsKey, twoHandedWeaponId); return(twoHandedWeapon); }
private void AssembleTwoHandedWeapon(Transform weaponContainer, TwoHandedWeapon weapon) { }