Skip to content

Commit 7824649

Browse files
committed
Actually add a cooldown on Zelos Influence to control lag and its own power
1 parent be42a40 commit 7824649

4 files changed

Lines changed: 33 additions & 14 deletions

File tree

Items/Weapons/Melee/ZalkYoyo.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using ChensGradiusMod.Projectiles.Melee;
2-
using Microsoft.Xna.Framework;
32
using Terraria;
43
using Terraria.ID;
54
using Terraria.ModLoader;
@@ -24,7 +23,7 @@ public override void SetDefaults()
2423
item.width = 30;
2524
item.height = 26;
2625
item.melee = true;
27-
item.damage = 180;
26+
item.damage = 250;
2827
item.knockBack = 8f;
2928
item.useTime = 25;
3029
item.useAnimation = 20;

Projectiles/Melee/ZalkYoyoProjectile.cs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using Terraria;
34
using Terraria.ID;
45
using Terraria.ModLoader;
@@ -8,8 +9,11 @@ namespace ChensGradiusMod.Projectiles.Melee
89
{
910
public class ZalkYoyoProjectile : ModProjectile
1011
{
12+
private const int Cooldown = 30;
1113
private const float AngleSpeed = 10f;
1214

15+
private int cooldownTick = Cooldown;
16+
1317
public List<Projectile> alliedZalks = new List<Projectile>();
1418
public float currentAngle = 0f;
1519

@@ -38,23 +42,28 @@ public override void SetDefaults()
3842

3943
public override void AI()
4044
{
45+
ProcessCooldown();
4146
UpdateReferenceAngle();
4247
DestroyAlliesWhenReturning();
4348
}
4449

4550
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
4651
{
47-
float xSpawn;
48-
if (Owner.direction == 1) xSpawn = Main.screenPosition.X - 28;
49-
else xSpawn = Main.screenPosition.X + Main.screenWidth + 28;
50-
int newAllyInd = Projectile.NewProjectile(xSpawn, projectile.Center.Y, 0, 0, ModContent.ProjectileType<AlliedZalk>(),
51-
projectile.damage, projectile.knockBack,
52-
projectile.owner, projectile.whoAmI);
53-
if (newAllyInd >= 0)
52+
if (cooldownTick >= Cooldown)
5453
{
55-
Projectile newProj = Main.projectile[newAllyInd];
56-
newProj.spriteDirection = Owner.direction;
57-
alliedZalks.Add(newProj);
54+
float xSpawn;
55+
if (Owner.direction == 1) xSpawn = Main.screenPosition.X - 28;
56+
else xSpawn = Main.screenPosition.X + Main.screenWidth + 28;
57+
int newAllyInd = Projectile.NewProjectile(xSpawn, projectile.Center.Y, 0, 0, ModContent.ProjectileType<AlliedZalk>(),
58+
projectile.damage, projectile.knockBack,
59+
projectile.owner, projectile.whoAmI);
60+
if (newAllyInd >= 0)
61+
{
62+
Projectile newProj = Main.projectile[newAllyInd];
63+
newProj.spriteDirection = Owner.direction;
64+
alliedZalks.Add(newProj);
65+
cooldownTick = 0;
66+
}
5867
}
5968
}
6069

@@ -69,6 +78,14 @@ public float AngleDifference
6978

7079
private Player Owner => Main.player[projectile.owner];
7180

81+
private void ProcessCooldown()
82+
{
83+
if (IsSameClientOwner(projectile))
84+
{
85+
cooldownTick = Math.Min(cooldownTick + 1, Cooldown);
86+
}
87+
}
88+
7289
private void UpdateReferenceAngle()
7390
{
7491
currentAngle += AngleSpeed * Owner.direction;

build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
displayName = Chen's Gradius Mod
22
author = blancfaye7
3-
version = 1.2.6
3+
version = 1.2.7
44
homepage = https://forums.terraria.org/index.php?threads/chens-gradius-mod.83289/
55
hideCode = true
66
hideResources = true

forum.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ For more information, visit this [URL=https://github.com/cheeeeeeeeeen/Chens-Gra
270270
The content is moved because it's hard to maintain a Wiki and a main post! However, the latest version change will still be here.
271271
Click [URL=https://github.com/cheeeeeeeeeen/Chens-Gradius-Mod/wiki/Changelog]here[/URL] for the full changelog.
272272

273+
1.2.7
274+
- Implement a cooldown system for Zelos Influence to control its power as well as lag management.
275+
273276
1.2.6
274277
- Implement Zelos Influence, a yoyo that spawns friendly Zalks.
275278
- Decreased Big Core Custom money rewards.

0 commit comments

Comments
 (0)