using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using TAPI;
using Terraria;
namespace DoctorWhoMod.Buffs
{
public class Regenerating : TAPI.ModBuff
{
public override void Start(Player P, int index)
{
P.statLife=P.statLifeMax;
Main.PlaySound(("DoctorWhoMod:Regenerating"), -1, -1, true, null, Single.NaN, Single.NaN, Single.NaN);
}
public override void Effects(Player P, int index)
{
P.lifeRegen+=5;
P.controlUp = false;
P.controlDown = false;
P.controlLeft = false;
P.controlRight = false;
P.controlJump = false;
P.noItems = true;
P.immuneAlpha = 0;
Color color = Color.Gold;
int count = 60;
for (int i = 1; i <= count; i++)
{
if (P.direction == -1)
{
//spawn dusts
int dust = Dust.NewDust(new Vector2((float) P.position.X + 2f, (float) P.position.Y + 12f), 10, 8, 57, P.velocity.X, -3f, 0, color, 1f); //head
Main.dust[dust].noGravity = true;
int dust2 = Dust.NewDust(new Vector2((float) P.position.X + 10f, (float) P.position.Y + 24f), 2, 2, 57, 5f, 3f, 0, color, 1f); //right arm
Main.dust[dust2].noGravity = true;
int dust3 = Dust.NewDust(new Vector2((float) P.position.X, (float) P.position.Y + 24f), 2, 2, 57, -5f, 3f, 0, color, 1f); //left arm
Main.dust[dust3].noGravity = true;
}
else
{
int dust = Dust.NewDust(new Vector2((float) P.position.X + 1f, (float) P.position.Y + 11f), 10, 8, 57, P.velocity.X, -3f, 0, color, 1f);
Main.dust[dust].noGravity = true;
int dust2 = Dust.NewDust(new Vector2((float) P.position.X + 10f, (float) P.position.Y + 21f), 2, 2, 57, 5f, 3f, 0, color, 1f);
Main.dust[dust2].noGravity = true;
int dust3 = Dust.NewDust(new Vector2((float) P.position.X + 3, (float) P.position.Y + 22f), 2, 2, 57, -5f, 3f, 0, color, 1f);
Main.dust[dust3].noGravity = true;
}
}
Lighting.AddLight((int)P.position.X, (int)P.position.Y, 255, 215, 0);
}
public override void End (Player P, int index)
{
int style = Main.rand.Next(123);
bool gender = Convert.ToBoolean(Main.rand.Next(2));
if(P.GetSubClass<MPlayer>().hairChange)
{
P.hair = style;
}
if(P.GetSubClass<MPlayer>().genderChange)
{
P.male = gender;
}
if(P.GetSubClass<MPlayer>().colourSkin)
{
P.skinColor = new Color(Main.rand.Next(255), Main.rand.Next(255), Main.rand.Next(255), 50);
}
if(P.GetSubClass<MPlayer>().colourHair)
{
P.hairColor = new Color(Main.rand.Next(255), Main.rand.Next(255), Main.rand.Next(255), 50);
}
if(P.GetSubClass<MPlayer>().colourEye)
{
P.eyeColor = new Color(0, Main.rand.Next(255), Main.rand.Next(255), Main.rand.Next(255));
}
P.statLife = P.statLifeMax;
}
}
}