Untitled
unknown
csharp
3 years ago
1.8 kB
12
Indexable
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
using WithBroomBetter.Common;
using WithBroomBetter.Common.Systems;
namespace WithBroomBetter.Buffs
{
public class PurityShieldMountBuff : ModBuff
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Purity Shield");
Description.SetDefault("The Spirit of Purity lends you power");
Main.buffNoTimeDisplay[Type] = true;
Main.buffNoSave[Type] = true;
}
int i = 0;
float speedY;
public override void Update(Player player, ref int buffIndex)
{
player.mount.SetMount(ModContent.MountType<Mounts.PurityShieldMount>(), player);
player.buffTime[buffIndex] = 10;
CustomPlayer x = player.GetModPlayer<CustomPlayer>();
x.purityShieldMount = !false;
if (x.purityShieldMount)
{
if (player.controlLeft)
{
player.velocity.X = -Mounts.PurityShieldMount.speed;
player.direction = -1;
}
else if (player.controlRight)
{
player.velocity.X = Mounts.PurityShieldMount.speed;
player.direction = 1;
}
else
{
player.velocity.X = 0f;
}
if (player.controlUp)
{
player.velocity.Y = -Mounts.PurityShieldMount.speed;
}
else if (player.controlDown)
{
player.velocity.Y = Mounts.PurityShieldMount.speed;
Vector2 test = Collision.TileCollision(player.position, player.velocity, player.width, player.height, true, false, (int)player.gravDir);
if (test.Y == 0f)
{
player.velocity.Y = 0.5f;
}
}
else
{
player.velocity.Y = 0f;
}
while (KeybindSystem.PurityMountSlowdown.JustPressed)
{
player.velocity *= 0.2f;
}
}
}
}
}
Editor is loading...