forked from Tyfyter/Light
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLight.cs
More file actions
188 lines (174 loc) · 6.07 KB
/
Light.cs
File metadata and controls
188 lines (174 loc) · 6.07 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.IO;
using Terraria.GameInput;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using Terraria.DataStructures;
using Terraria.GameContent.UI;
using System;
using System.Linq;
using Light.Items;
using Light.Buffs;
using static Terraria.ModLoader.ModContent;
//lumancy?
namespace Light
{
public class Light : Mod
{
internal static Mod mod;
/*public static void RedundantFunc()
{
var something = System.Linq.Enumerable.Range(1, 10);
}*/
public static string ChargeKey;
public static void ApplyLuxBoosts(ref NPC npc){
npc.npcSlots *= 20f;
npc.damage = (int)(npc.damage*1.56);
npc.defense *= 2;
npc.lifeMax = (int)(npc.lifeMax*2.5);
npc.life = npc.lifeMax;
npc.AddBuff(ModContent.BuffType<Lux>(), 3*npc.life);
npc.value = (int)(2*npc.value);
npc.GivenName = "Lux " + npc.GivenOrTypeName;
npc.rarity = (int)Math.Max(npc.rarity + 1, npc.rarity * 1.5f);
//npc.DisplayName.set("Lux "+npc.DisplayName.Get());
}
public static void ApplyShadeBoosts(ref NPC npc){
npc.npcSlots *= 20f;
npc.damage = (int)(npc.damage*2.56);
npc.defense += 15;
npc.defense *= 2;
npc.lifeMax = (int)(npc.lifeMax*2.5);
npc.life = npc.lifeMax;
npc.AddBuff(ModContent.BuffType<Umbra>(), 5*npc.life);
npc.value = (int)(3.5*npc.value);
npc.GivenName = "Umbra " + npc.GivenOrTypeName;
npc.rarity = (int)Math.Max(npc.rarity + 2, npc.rarity * 2);
//npc.modNPC.music = MusicID.PumpkinMoon;
if(npc.modNPC != null){
npc.modNPC.music = MusicID.PumpkinMoon;
//npc.modNPC.music = -255;
}
//npc.music = 0;
//npc.DisplayName.set("Umbra "+npc.DisplayName.Get());
}
private HotKey Channel = new HotKey("Charge Item", Keys.E);
private HotKey Ult = new HotKey("Use Ultimate", Keys.Q);
public static int LightCurrencyID;
public override void Load(){
mod = this;
RegisterHotKey(Channel.Name, Channel.DefaultKey.ToString());
RegisterHotKey(Ult.Name, Ult.DefaultKey.ToString());
LightCurrencyID = CustomCurrencyManager.RegisterCurrency(new LightForgeData(ModContent.ItemType<LightI>(), 999L)); //this defines the item Currency, so CustomCurrencyItem now is a Currency
//ChargeKey = Light.Cha;
ChargeKey = Channel.DefaultKey.ToString();
}
public Light()
{
Properties = new ModProperties()
{
Autoload = true,
AutoloadGores = true,
AutoloadSounds = true
};
}
public static bool GetBitFromInt(int data, int position){
int intReturn = data & (1 << position);
return (intReturn != 0);
}
public static void SetBitToInt(ref int data, int position){
data |= (1 << position);
}
public static string ReconsructString(string[] cut){
string full = "";
for(int i = 0; i > cut.Length; i++){
full = full + cut[i];
}
return full;
}
public override void AddRecipeGroups()
{
RecipeGroup group = new RecipeGroup(() => "Vines or Vine Ropes", new int[]
{
ItemID.Vine,
ItemID.VineRope
});
RecipeGroup.RegisterGroup("Light:Vines", group);
}
public override void HotKeyPressed(string name) {
if(PlayerInput.Triggers.Current.KeyStatus[GetTriggerName(name)]) {
if(name.Equals(Channel.Name)) {
ChannelF();
}
if(name.Equals(Ult.Name)) {
UltF();
}
}
/*if(PlayerInput.Triggers.JustPressed.KeyStatus[GetTriggerName(name)]) {
if(name.Equals(FixBug.Name)) {
FixFreeze();
}
}*/
}
/*public static void ModifyTooltips(List<TooltipLine> tooltips, Item item)
{
// Fist Items only
if (item.useStyle == useStyle)
{
int index = 0;
foreach (TooltipLine tooltip in tooltips)
{
if (tooltip.Name.Equals("TileBoost")) break;
index++;
}
int comboBonus = Main.LocalPlayer.GetModPlayer<ModPlayerFists>().comboCounterMaxBonus;
tooltips.RemoveAt(index);
TooltipLine tt = new TooltipLine(item.modItem.mod, "FistComboPower",
Math.Max(2, item.tileBoost + comboBonus) +
" combo power cost");
tt.overrideColor = tooltipColour;
tooltips.Insert(index, tt);
}
}*/
public void ChannelF()
{
Player player = Main.player[Main.myPlayer];
LightPlayer modPlayer = player.GetModPlayer<LightPlayer>();
modPlayer.channeling = 2;
//player.HeldItem.ReloadGun();
}
public void UltF()
{
Player player = Main.player[Main.myPlayer];
LightPlayer modPlayer = player.GetModPlayer<LightPlayer>();
modPlayer.Ult = 3;
//player.HeldItem.ReloadGun();
}
public string GetTriggerName(string name)
{
return Name + ": " + name;
}
public static short SetStaticDefaultsGlowMask(ModItem modItem)
{
if (!Main.dedServ)
{
Texture2D[] glowMasks = new Texture2D[Main.glowMaskTexture.Length + 1];
for (int i = 0; i < Main.glowMaskTexture.Length; i++)
{
glowMasks[i] = Main.glowMaskTexture[i];
}
glowMasks[glowMasks.Length - 1] = mod.GetTexture("Items/" + modItem.GetType().Name);
Main.glowMaskTexture = glowMasks;
return (short)(glowMasks.Length - 1);
}
else return 0;
}
}
}