-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlchEffects.cs
83 lines (82 loc) · 2.13 KB
/
AlchEffects.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 System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace PotionOverhaul
{
public class AlchEffects
{
public static float DiminishingReturns(float number, int amount, float amountToDiminish, float rate)
{
float f = 0f;
for (int a = 0; a < amount; a++)
{
f += number - amountToDiminish * (a * rate);
}
return f;
}
public static string AlchGetPositiveTooltip(Item item, int amount)
{
switch (item.type)
{
case (ItemID.Daybloom):
return "+ Slightly increases some stats during daytime";
case (ItemID.Fireblossom):
string Percentage = DiminishingReturns(0.25f, amount, 0.05f, 1f).ToString().Replace("0.", "").Replace("f", "");
if (Percentage.Length == 1) Percentage += "0";
return $"+ {Percentage}% of inflicting On fire! on hit";
//Todo implement this
case (ItemID.Shiverthorn):
return "+ Repeatedly striking enemies makes them more brittle!";
default:
return "";
}
}
public static string AlchGetNegativeTooltip(Item item, int amount)
{
switch (item.type)
{
case (ItemID.Shiverthorn):
return "- You are more brittle!";
default:
return "";
};
}
public static string AlchGetComboTooltip(Item item, int amount, List<Item> list)
{
switch (item.type)
{
default:
return "";
}
}
public static void AlchPostUpdateEquip(Player player, int amount, Item item)
{
switch (item.type)
{
case (ItemID.Daybloom):
if (Main.dayTime)
{
player.statDefense += 2 + (1 * amount);
player.meleeSpeed += 0.03f + (0.01f * amount + amount > 1 ? 0.01f : 0f);
player.allDamage += 0.03f + (0.01f * amount + amount > 1 ? 0.01f : 0f);
player.moveSpeed += 0.2f + (0.1f * amount);
}
break;
}
}
public static void AlchOnMeleeHit(Player player, int amount, Item item, NPC target, int damage, float knockback, bool crit)
{
switch (item.type)
{
case (ItemID.Fireblossom):
if (Main.rand.NextFloat() > DiminishingReturns(0.25f, amount, 0.05f, 1f))
{
target.AddBuff(BuffID.OnFire, 240);
}
break;
}
}
}
}