Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.Xna.Framework;
- using Terraria;
- using Terraria.ModLoader;
- using Microsoft.Xna.Framework.Graphics;
- using System.Collections.Generic;
- using Terraria.DataStructures;
- using Terraria.GameContent.Achievements;
- using Terraria.Graphics.Shaders;
- using Terraria.ID;
- using Terraria.Localization;
- using Terraria.Enums;
- using Terraria.ObjectData;
- namespace Dinosaur.Mounts
- {
- public class Mount_Controls : ModMountData
- {
- private int counter = 0;
- private int counterY = 0;
- private int counterZ = 0;
- private int counterYawn = 0;
- private bool attack = false; private int attackCoolDown = 0; private bool slowed;
- //Variables from mount. Useless for now
- int i1, i2, i3,
- a1, a2, a3,
- f1, f2, f3,
- r1, r2, r3,
- s1, s2, s3;
- //void Get(int i1, int i2, int i3, int a1, int a2, int a3, int f1, int f2, int f3, int r1, int r2, int r3, int s1, int s2, int s3);
- private int temp = 0;
- public override void UpdateEffects(Player player)
- {
- //Impacts/Landing
- //Sudden Stop
- if (Math.Abs(player.velocity.X) > 9f && Math.Abs(player.velocity.Y) == 0f && counter < 180)
- {
- counter++;
- }
- if (counter > 20 && (Math.Abs(player.velocity.X) < 6f) && Math.Abs(player.velocity.Y) == 0f)
- {
- //Normal Dust
- int dustIndex = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width - 12, player.height - 98, 31, player.velocity.X * -0.35f, player.velocity.Y * 1.3f, 100, default(Color), 0.2f);
- Main.dust[dustIndex].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex].fadeIn = 2f + (float)Main.rand.Next(90) * 0.1f;
- Main.dust[dustIndex].noGravity = true;
- //foward
- int dustIndex2 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width - 22, player.height - 98, 31, player.velocity.X * 0.1f, player.velocity.Y * 1.3f, 100, default(Color), 0.2f);
- Main.dust[dustIndex2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex2].fadeIn = 1.8f + (float)Main.rand.Next(50) * 0.1f;
- Main.dust[dustIndex2].noGravity = true;
- //Larger, Alpha Dust
- int dustIndex3 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width - 12, player.height - 98, 31, player.velocity.X * -0.55f, player.velocity.Y * 4.3f, 100, default(Color), 0.2f);
- Main.dust[dustIndex3].scale = 0.4f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex3].fadeIn = 0.2f + (float)Main.rand.Next(9) * 0.1f;
- Main.dust[dustIndex3].noGravity = true;
- Main.dust[dustIndex3].alpha = 150;
- //foward
- int dustIndex4 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width - 22, player.height - 98, 31, player.velocity.X * 0.3f, player.velocity.Y * 1.3f, 100, default(Color), 0.2f);
- Main.dust[dustIndex4].scale = 0.4f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex4].fadeIn = 0.2f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex4].noGravity = true;
- Main.dust[dustIndex4].alpha = 120;
- //Smoke Gore
- int goreIndex = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + 89), default(Vector2), Main.rand.Next(61, 64), 1f);
- Main.gore[goreIndex].scale = 0.5f;
- Main.gore[goreIndex].velocity.X = Main.gore[goreIndex].velocity.X + 1.5f;
- Main.gore[goreIndex].velocity.Y = Main.gore[goreIndex].velocity.Y + 1.5f;
- Main.gore[goreIndex].alpha = 230;
- counter--;
- if (Math.Abs(player.velocity.X) <= 0f && Math.Abs(player.velocity.Y) == 0f)
- counter = 0;
- }
- //Up and down
- if (Math.Abs(player.velocity.Y) > 8f && counterY < 180)
- {
- counterY++;
- }
- if (counterY > 20 && (Math.Abs(player.velocity.Y) == 0f))
- {
- //Normal Dust
- for (int i = 0; i < 10; i++)
- {
- int dustIndex = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width - 12, player.height - 98, 31, player.velocity.X - 1f, player.velocity.Y * -1.3f, 100, default(Color), 0.2f);
- Main.dust[dustIndex].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex].fadeIn = 2f + (float)Main.rand.Next(90) * 0.1f;
- Main.dust[dustIndex].noGravity = true;
- int dustIndex2 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width + 12, player.height - 98, 31, player.velocity.X + 1f, player.velocity.Y * -1.3f, 100, default(Color), 0.2f);
- Main.dust[dustIndex2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex2].fadeIn = 2f + (float)Main.rand.Next(90) * 0.1f;
- Main.dust[dustIndex2].noGravity = true;
- }
- counterY--;
- if (Math.Abs(player.velocity.Y) <= 4f)
- counterY = 0;
- }
- //Sudden Jump
- if (Math.Abs(player.velocity.Y) < 0.1f && counterZ < 60)
- {
- counterZ++;
- }
- if (counterZ > 10 && (Math.Abs(player.velocity.Y) > 2f))
- {
- //Normal Dust
- for (int i = 0; i < 10; i++)
- {
- int dustIndex = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width, player.height - 198, 31, player.velocity.X * -1.3f, player.velocity.Y * 0.2f, 100, default(Color), 0.2f);
- Main.dust[dustIndex].scale = 0.05f + (float)Main.rand.Next(5) * 0.08f;
- Main.dust[dustIndex].fadeIn = 1f + (float)Main.rand.Next(90) * 0.1f;
- Main.dust[dustIndex].noGravity = true;
- int dustIndex2 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width, player.height - 198, 31, player.velocity.X * -0.6f, player.velocity.Y * 0.1f, 100, default(Color), 0.2f);
- Main.dust[dustIndex2].scale = 0.05f + (float)Main.rand.Next(5) * 0.08f;
- Main.dust[dustIndex2].fadeIn = 1f + (float)Main.rand.Next(90) * 0.1f;
- Main.dust[dustIndex2].noGravity = true;
- }
- counterZ--;
- if (Math.Abs(player.velocity.Y) >= 0.1f)
- counterZ = 0;
- }
- //Idle mechanics
- //Sits down
- if (counterYawn < 2300 && Math.Abs(player.velocity.X) < .1f && Math.Abs(player.velocity.X) > -.2f && Math.Abs(player.velocity.Y) == 0f)
- {
- counterYawn++;
- }
- if (Math.Abs(player.velocity.X) != 0f || Math.Abs(player.velocity.Y) != 0f)
- {
- counterYawn = 0;
- }
- if (counterYawn >= 2155)
- {
- //mountData.yOffset = 10;
- mountData.idleFrameCount = 1;
- mountData.idleFrameDelay = 15;
- mountData.idleFrameStart = 20;
- mountData.idleFrameLoop = true;
- }
- //Run control
- //Running
- if (Math.Abs(player.velocity.X) > 3f)
- {
- mountData.jumpSpeed = 6.5f;
- mountData.runningFrameCount = 6;
- mountData.runningFrameDelay = 80;
- mountData.runningFrameStart = 6;
- }
- //Sprinting
- if (Math.Abs(player.velocity.X) > 8f)
- {
- mountData.jumpSpeed = 9f;
- mountData.runningFrameCount = 6;
- mountData.runningFrameDelay = 65;
- mountData.runningFrameStart = 6;
- }
- }
- //Attack
- public override void UseAbility(Player player, Vector2 mousePosition, bool toggleOn)
- {
- if (Main.mouseRight && attackCoolDown == 0 && player.velocity.Y < 1 && player.velocity.Y > -1)
- {
- attack = true;
- attackCoolDown = 65;
- temp = 0;
- }
- if (attack == true)
- {
- //Slowing Down
- mountData.runSpeed -= 0.5f;
- if (mountData.runSpeed == 0)
- {
- slowed = true;
- }
- }
- if (slowed == true)
- {
- //If mount has slowed down:
- mountData.runningFrameCount = 5;
- mountData.runningFrameDelay = 15;
- mountData.runningFrameStart = 21;
- //Different Stages to run frames at different speeds, with different momentum.
- if (attackCoolDown < 50)
- {
- int dustIndex = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 89), player.width - 12, player.height - 98, 31, player.velocity.X * -0.35f, player.velocity.Y * 1.3f, 100, default(Color), 0.2f);
- Main.dust[dustIndex].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
- Main.dust[dustIndex].fadeIn = 2f + (float)Main.rand.Next(90) * 0.1f;
- Main.dust[dustIndex].noGravity = true;
- mountData.runningFrameDelay = 14;
- player.velocity.X = 0.8f * (player.direction);
- if (temp < 3)
- {
- Projectile.NewProjectileDirect(new Vector2(player.position.X + 45 * player.direction, player.position.Y + 2 * attackCoolDown - 20), new Vector2(1.5f * player.velocity.X, player.velocity.Y), mod.ProjectileType("Slash"), 50, 4f, Main.myPlayer, 0, 0);
- temp++;
- }
- }
- if (attackCoolDown < 35)
- {
- mountData.runningFrameDelay = 12;
- //player.position.X;
- player.velocity.X += 1.75f* player.direction;
- }
- if (attackCoolDown < 20)
- {
- mountData.runningFrameDelay = 13;
- player.velocity.X -= 4f * (player.direction);
- }
- if (attackCoolDown < 10)
- {
- mountData.runningFrameDelay = 15;
- player.velocity.X /= 1.5f;
- }
- }
- if (attackCoolDown != 0)
- {
- attackCoolDown--;
- }
- if (attackCoolDown == 0)
- {
- mountData.runSpeed = 12f;
- attack = false;
- slowed = false;
- }
- }
- //continues
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement