-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEBFPlayer.cs
More file actions
42 lines (39 loc) · 1.54 KB
/
EBFPlayer.cs
File metadata and controls
42 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using EBF.Items.Ranged.Bows;
using EBF.Items.Summon;
using Terraria;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace EBF
{
public class EBFPlayer : ModPlayer
{
public bool hasHeardDownedNeonValkLine = false; // special line from Lance that we only want to hear once
public bool tetrominoEquipped = false;
public override void SaveData(TagCompound tag) => tag["hasHeardDownedNeonValkLine"] = hasHeardDownedNeonValkLine;
public override void LoadData(TagCompound tag) => hasHeardDownedNeonValkLine = tag.GetBool("hasHeardDownedNeonValkLine");
public override void ResetEffects() => tetrominoEquipped = false;
public override void ModifyHurt(ref Player.HurtModifiers modifiers) => modifiers.ModifyHurtInfo += ModifyHurtInfo;
public override void PostUpdateRunSpeeds()
{
// Riot shield slows while held
if (Player.HeldItem.type == ModContent.ItemType<RiotShield>())
{
Player.accRunSpeed *= 0.8f;
Player.moveSpeed *= 0.8f;
}
// Regal turtle slows while shooting
if (Player.HeldItem.type == ModContent.ItemType<RegalTurtle>() && Player.channel)
{
Player.accRunSpeed *= 0.6f;
Player.moveSpeed *= 0.6f;
}
}
private void ModifyHurtInfo(ref Player.HurtInfo info)
{
if (tetrominoEquipped && info.Damage % 10 == 4)
{
info.Damage = 4;
}
}
}
}