Wings of Rebirth code
This commit is contained in:
1 parent
cb741f19bb
commit
1452ccfb3e
11 files changed
+87
-11
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using CalamityMod.Items.Accessories.Wings;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Graphics.PackedVector;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.CalPlayer.DrawLayers
|
||||
{
|
||||
public class WingsofRebirthLayer : PlayerDrawLayer
|
||||
{
|
||||
public static Asset<Texture2D> yharwingTexture;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
yharwingTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Accessories/Wings/WingsofRebirth_Wings_Real");
|
||||
}
|
||||
|
||||
public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.Wings);
|
||||
|
||||
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => drawInfo.drawPlayer.wings == EquipLoader.GetEquipSlot(Mod, "WingsofRebirth", EquipType.Wings);
|
||||
|
||||
protected override void Draw(ref PlayerDrawSet drawInfo)
|
||||
{
|
||||
Player drawPlayer = drawInfo.drawPlayer;
|
||||
|
||||
if (drawPlayer.dead)
|
||||
return;
|
||||
|
||||
Texture2D texture = yharwingTexture.Value;
|
||||
Vector2 Position = drawInfo.Position;
|
||||
Vector2 pos = new Vector2((int)(Position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (2 * drawPlayer.direction)), (int)(Position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) - 2f * drawPlayer.gravDir));
|
||||
Color lightColor = Lighting.GetColor((int)drawPlayer.Center.X / 16, (int)drawPlayer.Center.Y / 16, Color.White);
|
||||
Color color = lightColor * (1 - drawInfo.shadow);
|
||||
DrawData d = new DrawData(texture, pos, texture.Frame(1, 8, 0, drawInfo.drawPlayer.wingFrame), drawInfo.colorArmorBody, 0f, new Vector2(texture.Width / 2, texture.Height / 16), 1f, drawInfo.playerEffect, 0);
|
||||
d.shader = drawInfo.drawPlayer.cWings;
|
||||
drawInfo.DrawDataCache.Add(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 443 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -78,7 +78,7 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<TracersElysian>().
|
||||
AddIngredient<DrewsWings>().
|
||||
AddIngredient<WingsofRebirth>().
|
||||
AddIngredient<AuricBar>(5).
|
||||
AddTile<CosmicAnvil>().
|
||||
Register();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -8,14 +9,16 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
// The equip sprite is actually blank as a custom draw layer is used to draw the real sprites without any base sprites conflicting
|
||||
[LegacyName("DrewsWings")]
|
||||
[AutoloadEquip(EquipType.Wings)]
|
||||
public class DrewsWings : ModItem, ILocalizedModType
|
||||
public class WingsofRebirth : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Accessories.Wings";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(361, 11.5f, 2.9f);
|
||||
ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(360, 11.5f, 2.9f);
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -36,7 +39,7 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.GemDiamond, 0f, 0f, 100, default, 2.4f);
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
@@ -48,6 +51,37 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
player.noFallDmg = true;
|
||||
}
|
||||
|
||||
public override bool WingUpdate(Player player, bool inUse)
|
||||
{
|
||||
if (player.controlJump && player.wingTime > 0 && player.velocity.Y != 0)
|
||||
{
|
||||
int frameRate = 5;
|
||||
int maxFrames = 8;
|
||||
player.wingFrameCounter++;
|
||||
if (player.wingFrameCounter >= frameRate * (maxFrames - 1))
|
||||
{
|
||||
player.wingFrameCounter = 0;
|
||||
player.wingFrame = 0;
|
||||
}
|
||||
if (player.wingFrameCounter % frameRate == 0)
|
||||
{
|
||||
player.wingFrame++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.wingFrameCounter = 0;
|
||||
player.wingFrame = 0;
|
||||
if (player.velocity.Y != 0)
|
||||
{
|
||||
player.wingFrame = 1;
|
||||
if (player.controlJump && player.velocity.Y > 0)
|
||||
player.wingFrame = 7;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
|
||||
{
|
||||
ascentWhenFalling = 1f;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1021 B |
Binary file not shown.
|
After Width: | Height: | Size: 165 B |
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
@@ -78,7 +78,7 @@ namespace CalamityMod.Items.TreasureBags
|
||||
itemLoot.Add(ModContent.ItemType<YharimsCrystal>(), 10);
|
||||
|
||||
// Equipment
|
||||
itemLoot.Add(ModContent.ItemType<DrewsWings>());
|
||||
itemLoot.Add(ModContent.ItemType<WingsofRebirth>());
|
||||
itemLoot.Add(ModContent.ItemType<YharimsGift>());
|
||||
itemLoot.AddRevBagAccessories();
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@ AureateBooster: {
|
||||
'''
|
||||
}
|
||||
|
||||
DrewsWings: {
|
||||
DisplayName: Drew's Wings
|
||||
WingsofRebirth: {
|
||||
DisplayName: Wings of Rebirth
|
||||
Tooltip:
|
||||
'''
|
||||
Horizontal speed: 11.50
|
||||
Acceleration multiplier: 2.9
|
||||
Excellent vertical speed
|
||||
Flight time: 361
|
||||
'Absolutely Fabulous'
|
||||
Flight time: 360
|
||||
'Resplendent to the very end'
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -3001,7 +3001,7 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
// Equipment
|
||||
normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType<YharimsGift>()));
|
||||
normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType<DrewsWings>()));
|
||||
normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType<WingsofRebirth>()));
|
||||
}
|
||||
|
||||
// Trophy (always directly from boss, never in bag)
|
||||
|
||||
Reference in new issue
Block a user