-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPathOfTerrariaPlayer.cs
83 lines (72 loc) · 2.59 KB
/
PathOfTerrariaPlayer.cs
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
using Terraria.ID;
namespace PathOfTerraria
{
class PathOfTerrariaPlayer : ModPlayer
{
public static PathOfTerrariaPlayer ModPlayer(Player player)
{
return player.GetModPlayer<PathOfTerrariaPlayer>();
}
public bool farrulSetBonus;
public bool arcaneCloak;
public override void ResetEffects()
{
farrulSetBonus = false;
arcaneCloak = false;
}
public override void UpdateDead()
{
}
public override void GetWeaponDamage(Item item, ref int damage)
{
if (arcaneCloak && item.magic)
{
float manaPercent = (float)player.statMana / player.statManaMax2;
//multiplicative damage boost of 10% at max mana
damage += (int)(damage * manaPercent / 10);
}
}
public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
{
if (farrulSetBonus && Main.rand.NextFloat() < 0.05f)
{
player.NinjaDodge();
return false;
}
if (arcaneCloak)
{
//30% damage reduction
int reduction = (int)((float)damage * 0.3);
//if the damage reduction is more than the mana than the
//player has left, consume the rest of player's mana
//otherwise, normal 30% reduction
if (reduction > player.statMana)
{
reduction = player.statMana;
}
damage -= reduction;
player.statMana -= reduction;
player.ManaEffect(-reduction);
}
return true;
}
public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
{
if (farrulSetBonus)
{
target.AddBuff(BuffID.Venom, 5 * 60);
}
}
public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (farrulSetBonus)
{
target.AddBuff(BuffID.Venom, 5 * 60);
}
}
}
}