-
Notifications
You must be signed in to change notification settings - Fork 17
/
ModBeam.cs
191 lines (161 loc) · 5.51 KB
/
ModBeam.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
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
189
190
191
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ModLoader;
using MetroidMod.Default;
using MetroidMod.ID;
namespace MetroidMod
{
/*
public abstract class ModBeam : ModType
{
public int Type { get; private set; }
internal void ChangeType(int type)
{
Type = type;
}
public ModItem Item;
public ModTile Tile;
public int ItemType { get; internal set; }
public int TileType { get; internal set; }
/// <summary>
/// The translations for the display name of this item.
/// </summary>
public ModTranslation DisplayName { get; internal set; }
/// <summary>
/// The translations for the tooltip of this item.
/// </summary>
public ModTranslation Tooltip { get; internal set; }
//public Asset<Texture2D>[] Textures { get; internal set; }
public abstract string ItemTexture { get; }
public abstract string TileTexture { get; }
/// <summary>
/// Path to the texture of the normal shot when fired.
/// </summary>
public abstract string ProjectileTexture { get; }
/// <summary>
/// Path to the texture of the 'sphere' in front of the cannon while charging the shot.
/// </summary>
public abstract string ChargeLeadTexture { get; }
/// <summary>
/// Path to the texture of the charge shot when fired.
/// </summary>
public abstract string ChargeProjectileTexture { get; }
/// <summary>
/// Path to the texture to display on the Power Beam if the beam is equipped. Don't set to anything if you want it to keep to its default value. <br/>
/// Requires an "_alt" file as well.
/// </summary>
public abstract string PowerBeamTexture { get; }
public abstract bool AddOnlyBeamItem { get; }
public int SacrificeTotal { get; set; } = 1;
public virtual int DustCount { get; set; } = -1;
public virtual int DustType { get; set; } = -1;
/// <summary>
/// Path to the sound played upon normal shot.
/// </summary>
public virtual string ShotSound { get; set; } = null;
/// <summary>
/// Path to the sound played while charging the beam.
/// </summary>
public virtual string ChargingSound { get; set; } = null;
/// <summary>
/// Path to the sound played upon charged shot.
/// </summary>
public virtual string ChargeShotSound { get; set; } = null;
public int AddonSlot { get; set; } = BeamAddonSlotID.None;
public string GetAddonSlotName() => BeamLoader.GetAddonSlotName(AddonSlot);
public uint AddonVersion { get; set; } = 0;
public string GetAddonVersionName()
{
return AddonVersion switch
{
0 => "[c/FFFFFF:Prototypical Power Beam Addon]",
1 => "[c/9696FF:Power Beam Addon]",
2 => "[c/FF9696:Power Beam Addon V2]",
3 => "[c/FF9696:Power Beam Addon V3]",
4 => "[c/96FF96:Power Beam Addon V4]",
5 => "[c/96FFFF:Power Beam Addon V5]",
_ => $"[c/969696:Power Beam Addon V{AddonVersion}]",
};
}
/// <summary>
/// Sets the damage multiplier for a charged shot. (CHARGE SLOT ONLY)
/// </summary>
public float AddonChargeDamage { get; set; } = 1f;
/// <summary>
/// Sets a normal damage multiplier (NON-CHARGE SLOT ONLY)
/// </summary>
public float AddonDamageMult { get; set; } = 0f;
/// <summary>
/// Sets the heat multiplier for a charged shot (CHARGE SLOT ONLY)
/// </summary>
public float AddonChargeHeat { get; set; } = 1f;
/// <summary>
/// Sets a normal heat multiplier (NON-CHARGE SLOT ONLY)
/// </summary>
public float AddonHeat { get; set; } = 0f;
/// <summary>
/// Sets a normal speed multiplier (NON-CHARGE SLOT ONLY)
/// </summary>
public float AddonSpeed { get; set; } = 0f;
public Color BeamColor { get; set; } = MetroidMod.powColor;
public int WaveDepth { get; set; } = 4;
/// <summary>
/// Determines if the addon can generate on Chozo Statues during world generation.
/// </summary>
public virtual bool CanGenerateOnChozoStatue(int x, int y) => false;
public override sealed void SetupContent()
{
SetStaticDefaults();
InternalStaticDefaults();
Item.SetStaticDefaults();
}
internal virtual void InternalStaticDefaults() { }
public override void Load()
{
Item = new BeamItem(this);
Tile = new BeamTile(this);
if (Item == null) { throw new Exception("WTF happened here? BeamItem is null!"); }
if (Tile == null) { throw new Exception("WTF happened here? BeamTile is null!"); }
Mod.AddContent(Item);
Mod.AddContent(Tile);
}
protected override sealed void Register()
{
DisplayName = LocalizationLoader.CreateTranslation(Mod, $"BeamName.{Name}");
Tooltip = LocalizationLoader.CreateTranslation(Mod, $"BeamTooltip.{Name}");
if (!AddOnlyBeamItem)
{
Type = BeamLoader.BeamCount;
if (Type > 127)
{
throw new Exception("Beams Limit Reached. (Max: 128)");
}
BeamLoader.beams.Add(this);
}
MetroidMod.Instance.Logger.Info($"Register new Beam: {FullName}, OnlyBeamItem: {AddOnlyBeamItem}");
}
public override void SetStaticDefaults()
{
base.SetStaticDefaults();
}
public virtual void SetItemDefaults(Item item) { }
public virtual void OnHit(Entity entity) { }
public virtual bool OnShoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
return true;
}
public virtual bool CanUse(Player player)
{
return true;
}
/// <inheritdoc cref="ModItem.AddRecipes"/>
public virtual void AddRecipes() { }
public Recipe CreateRecipe(int amount = 1) => Item.CreateRecipe(amount);
}
*/
}