Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Terraria;
- using Terraria.ModLoader;
- namespace QwertysRandomContent.NPCs.RuneSpectorBoss
- {
- class GreenRune : ModProjectile
- {
- public override void SetDefaults()
- {
- projectile.aiStyle = -1;
- projectile.width = 200;
- projectile.height = 200;
- projectile.friendly = false;
- projectile.hostile = false;
- projectile.penetrate = -1;
- projectile.alpha = 255;
- projectile.tileCollide = false;
- projectile.timeLeft = 255 + 120 * 6;
- }
- public bool runOnce = true;
- public int runeTimer = -255;
- public Projectile leechRune;
- public float startDistance = 100f;
- public override void AI()
- {
- Player player = Main.player[projectile.owner];
- projectile.velocity = new Vector2(0, 0);
- if (projectile.alpha > 0)
- projectile.alpha--;
- else
- {
- projectile.alpha = 0;
- }
- runeTimer++;
- if (runeTimer >=120)
- {
- if (Main.netMode != 1)
- {
- projectile.ai[1] = MathHelper.ToRadians(Main.rand.Next(0, 360));
- projectile.netUpdate = true;
- Projectile.NewProjectile(player.Center.X + (float)Math.Cos(projectile.ai[1]) * startDistance, player.Center.Y + (float)Math.Sin(projectile.ai[1]) * startDistance, 0, 0, mod.ProjectileType("LeechRune"), projectile.damage, 3f, Main.myPlayer);
- }
- runeTimer = 0;
- }
- }
- }
- class LeechRune : ModProjectile
- {
- public override void SetDefaults()
- {
- projectile.aiStyle = -1;
- projectile.width = 50;
- projectile.height = 50;
- projectile.friendly = false;
- projectile.penetrate = -1;
- projectile.alpha = 255;
- projectile.tileCollide = false;
- projectile.timeLeft = 120;
- projectile.hostile = false;
- }
- public bool runOnce = true;
- public int runeTimer;
- public Projectile leechRune;
- public float attackAngle;
- public float attackSpeed = 10f;
- public override void AI()
- {
- Player player = Main.player[projectile.owner];
- projectile.velocity = new Vector2(0, 0);
- if (projectile.alpha > 0)
- {
- projectile.alpha -= 255 / 60;
- projectile.hostile = false;
- }
- else
- {
- projectile.alpha = 0;
- }
- runeTimer += 255 / 60;
- if (runeTimer >=255)
- {
- if (runOnce )
- {
- attackAngle = (player.Center - projectile.Center).ToRotation();
- runOnce = false;
- }
- projectile.rotation += MathHelper.ToRadians(3);
- projectile.hostile = true;
- projectile.velocity = new Vector2((float)Math.Cos(attackAngle) * attackSpeed, (float)Math.Sin(attackAngle) * attackSpeed);
- }
- }
- public NPC runeSpector;
- public override void OnHitPlayer(Player target, int damage, bool crit)
- {
- foreach (NPC npcSearch in Main.npc)
- {
- if (npcSearch.type == mod.NPCType("RuneSpector"))
- runeSpector = npcSearch;
- }
- if (runeSpector.active)
- {
- runeSpector.life += damage * 20;
- CombatText.NewText(runeSpector.getRect(), Color.Green, damage * 20, false, true);
- }
- }
- public override void Kill(int timeLeft)
- {
- Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("LeechRuneDeath"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement