-
Notifications
You must be signed in to change notification settings - Fork 4
feat: terraria prism big laser #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,13 @@ | ||
| --- src/Terraria/Terraria/Projectile.cs | ||
| +++ src/TerraAngel/Terraria/Projectile.cs | ||
| @@ -3,6 +_,7 @@ | ||
| using Microsoft.Xna.Framework; | ||
| using Microsoft.Xna.Framework.Audio; | ||
| using ReLogic.Utilities; | ||
| +using TerraAngel.Tools.Exploit; | ||
| using Terraria.Audio; | ||
| using Terraria.Chat; | ||
| using Terraria.DataStructures; | ||
| @@ -20118,6 +_,7 @@ | ||
| flag = true; | ||
| } | ||
|
|
@@ -64,6 +72,72 @@ | |
| rotation = rotation.AngleLerp(idleRotation3, 0.45f); | ||
| if (Main.rand.Next(20) == 0) | ||
| { | ||
| @@ -68518,7 +_,17 @@ | ||
| num37 = 5f; | ||
| } | ||
|
|
||
| + if (ToolManager.GetTool<TerrariaPrismTool>().IsToolProjectile(whoAmI)) | ||
| + { | ||
| + if (velocity == Vector2.Zero) | ||
| + { | ||
| + velocity = -Vector2.UnitY; | ||
| + } | ||
| + } | ||
| + else | ||
| + { | ||
| - damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); | ||
| + damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这边一般习惯是在patch上不做任何额外缩进,方便版本更新后patcher fuzzy match |
||
| + } | ||
| ai[0] += 1f; | ||
| ai[1] += 1f; | ||
| bool flag8 = false; | ||
| @@ -68538,7 +_,7 @@ | ||
| { | ||
| ai[1] = 0f; | ||
| flag9 = true; | ||
| - if (Main.myPlayer == owner) | ||
| + if (Main.myPlayer == owner && !ToolManager.GetTool<TerrariaPrismTool>().IsToolProjectile(whoAmI)) | ||
| { | ||
| float num39 = player.inventory[player.selectedItem].shootSpeed * scale; | ||
| Vector2 vector18 = vector; | ||
| @@ -68588,20 +_,33 @@ | ||
|
|
||
| if (flag9 && Main.myPlayer == owner) | ||
| { | ||
| - bool flag10 = false; | ||
| - flag10 = !flag8 || player.CheckMana(player.inventory[player.selectedItem].mana, pay: true); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要做多余修改,不然patcher不好识别 |
||
| - if (player.channel && flag10 && !player.noItems && !player.CCed) | ||
| + bool flag10 = !flag8 || player.CheckMana(player.inventory[player.selectedItem].mana, pay: true); | ||
| + if (ToolManager.GetTool<TerrariaPrismTool>().IsToolProjectile(whoAmI)) | ||
| + { | ||
| + if (ai[0] == 181f) | ||
| + { | ||
| + Vector2 center2 = base.Center; | ||
| + int num41 = damage; | ||
| + for (int m = 0; m < 6; m++) | ||
| + { | ||
| + var index = NewProjectile(GetProjectileSource_FromThis(), center2.X, center2.Y, velocity.X, velocity.Y, 632, num41, knockBack, owner, m, whoAmI); | ||
| + Main.projectile[index].timeLeft = int.MaxValue; | ||
| + } | ||
| + netUpdate = true; | ||
| + } | ||
| + } | ||
| + else if (player.channel && flag10 && !player.noItems && !player.CCed) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. else |
||
| { | ||
| if (ai[0] == 1f) | ||
| { | ||
| Vector2 center2 = base.Center; | ||
| + int num41 = damage; | ||
| Vector2 vector19 = Vector2.Normalize(velocity); | ||
| if (float.IsNaN(vector19.X) || float.IsNaN(vector19.Y)) | ||
| { | ||
| vector19 = -Vector2.UnitY; | ||
| } | ||
|
|
||
| - int num41 = damage; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个也是,不要做多余修改,不然patcher不好识别 |
||
| for (int m = 0; m < 6; m++) | ||
| { | ||
| NewProjectile(GetProjectileSource_FromThis(), center2.X, center2.Y, vector19.X, vector19.Y, 632, num41, knockBack, owner, m, whoAmI); | ||
| @@ -79444,7 +_,7 @@ | ||
| Vector2 value13 = vector73.RotatedBy(((num904 == 0) ? 1f : (-1f)) * ((float)Math.PI * 2f) / (num899 * 2f)); | ||
| for (float num905 = 0f; num905 < num902; num905++) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace TerraAngel.Tools.Exploit; | ||
|
|
||
| public class TerrariaPrismTool : Tool | ||
| { | ||
| public override string Name => GetString("TerrariaPrism Tool"); | ||
|
|
||
| public override ToolTabs Tab => ToolTabs.MiscTools; | ||
|
|
||
| private bool _fireLaser; | ||
|
|
||
| private int _damage = 200; | ||
|
|
||
| private readonly HashSet<int> _projectiles = []; | ||
|
|
||
| public override void DrawUI(ImGuiIOPtr io) | ||
| { | ||
| ImGui.PushID(nameof(TerrariaPrismTool)); | ||
|
|
||
| if (ImGui.CollapsingHeader(GetString("TerrariaPrism"))) | ||
| { | ||
| if(ImGui.Checkbox(GetString("Enable"), ref _fireLaser)) | ||
| { | ||
| if (_fireLaser) | ||
| { | ||
| for (var dir = 0; dir < 8; dir++) | ||
| { | ||
| var angle = dir * (float)Math.PI / 4f; | ||
| var direction = new Vector2((float)Math.Sin(angle), -(float)Math.Cos(angle)); | ||
| var projIndex = Projectile.NewProjectile(Projectile.GetNoneSource(), Main.LocalPlayer.Center, direction, ProjectileID.LastPrism, _damage, 10, Main.myPlayer, 180f, 0f, 0f); | ||
| _projectiles.Add(projIndex); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| _projectiles.Clear(); | ||
|
Controllerdestiny marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
| if (ImGui.SliderInt(GetString("Damage"), ref _damage, 1, 1000) && _projectiles.Count > 0) | ||
| { | ||
| foreach (var index in _projectiles) | ||
| { | ||
| Main.projectile[index].damage = _damage; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ImGui.PopID(); | ||
| } | ||
|
|
||
| public bool IsToolProjectile(int projectileIndex) | ||
| { | ||
| return _projectiles.Contains(projectileIndex); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
被 patch 的文件不能随便加using,换成下面用全称的方式