コード例 #1
0
 public override void DisplayHints(MyPlayer player, Entities.MyEntity me)
 {
     if (!MySession.Static.IsScenario)
         return;
     if (m_IsTrue)
     {
         //Sync.Players.RespawnComponent.CloseRespawnScreen();//MyGuiScreenMedicals.Close();
         m_begin = DateTime.MinValue;
     }
     else
     {
         if (Sync.Players.RespawnComponent.IsInRespawnScreen())//if (MyGuiScreenMedicals.Static!=null && MyGuiScreenMedicals.Static.State == MyGuiScreenState.OPENED)//~character dead
         {
             if (m_begin == DateTime.MinValue)
                 m_begin = DateTime.UtcNow;
         }
         else
         {
             m_begin = DateTime.MinValue;
         }
         if (m_begin == DateTime.MinValue)
             return;
         TimeSpan difference = m_limit - (DateTime.UtcNow - m_begin);
         var seconds = difference.Seconds;
         if (m_lastSeconds != seconds)
         {
             m_lastSeconds = seconds;
             m_guiText.Clear().AppendFormat(MyTexts.GetString(MySpaceTexts.ScreenMedicals_NoRespawnPlace), (int)difference.TotalMinutes, seconds);
             Sync.Players.RespawnComponent.SetNoRespawnText(m_guiText, (int)difference.TotalSeconds);//MyGuiScreenMedicals.NoRespawnText = m_guiText;
         }
     }
 }
コード例 #2
0
 public override bool Update(MyPlayer player, MyEntity me)
 {
     if (MySession.Static.IsScenario)
         if (m_limit <= DateTime.UtcNow - MyScenarioSystem.Static.ServerStartGameTime)
             m_IsTrue = true;
     return IsTrue;
 }
コード例 #3
0
 public override bool Update(MyPlayer player, MyEntity me)
 {
     if (me!=null)
         if (Vector3D.DistanceSquared(me.PositionComp.GetPosition(), TargetPos) > m_maxDistance2)
             m_IsTrue = true;
     return IsTrue;
 }
コード例 #4
0
	public SkillStateMgr( MyPlayer cha )
	{
		m_char = cha;
		m_aryStats.Add ( 0,new NormalState("normal") );
		m_aryStats.Add ( 1,new JumpState("jump") );
		m_aryStats.Add ( 2,new WheelState("wheel") );
		m_aryStats.Add ( 3,new TeleportState("teleport") );
	}
コード例 #5
0
    public void SaveGame()
    {
        MyPlayer ply = new MyPlayer();
        ply.SetDomain(SceneManager.GetActiveScene().buildIndex);
        BinaryFormatter bf = new BinaryFormatter();
        FileStream fl = File.Create(Application.persistentDataPath + "/player.dat");

        bf.Serialize(fl, ply);
        fl.Close();
    }
コード例 #6
0
	void Awake()
	{
		mytransform = transform;
		myrenderer = GetComponent<Renderer>();
		//maincamera = Camera.main.transform;
		GetComponent<Renderer>().sharedMaterial.renderQueue = 4003;
		cha1 = GameObject.FindWithTag("Player").transform;
		script_cha = cha1.GetComponent<MyPlayer>();
	
		m_dir = new Vector3();
	}
コード例 #7
0
 public override void DisplayHints(MyPlayer player, MyEntity me)
 {
     if (!MySession.Static.IsScenario || MyScenarioSystem.Static.ServerStartGameTime==DateTime.MaxValue)
         return;
     TimeSpan difference = m_limit - (DateTime.UtcNow - MyScenarioSystem.Static.ServerStartGameTime);
     var seconds = difference.Seconds;
     if (m_lastSeconds!=seconds)
     {
         m_lastSeconds=seconds;
         MyHud.ScenarioInfo.TimeLeftMin = (int)difference.TotalMinutes;
         MyHud.ScenarioInfo.TimeLeftSec = seconds;
     }
 }
コード例 #8
0
 public bool UpdateWin(MyPlayer.PlayerId Id, MyEntity me)
 {
     if (Won || Lost)
         return true;
     for (int i=0;i<m_winTriggers.Count;i++)
     {
         var trigger=m_winTriggers[i];
         if (trigger.IsTrue || trigger.Update(me))
         { //Won!
             MySyncMissionTriggers.PlayerWon(Id, i);
             return true;
         }
     }
     return false;
 }
コード例 #9
0
        /// <summary>
        /// Heals the specified player.
        /// </summary>
        /// <param name="Player">The player.</param>
        /// <param name="TargetPlayerName">Name of the target player.</param>
        public static void Heal(MyPlayer Player, string TargetPlayerName)
        {
            int stack = 20;
            MyPlayer oTargetPlayer = null;

            if (Player == null)
            {
                return;
            }

            try
            {
                if (!string.IsNullOrEmpty(TargetPlayerName))
                {
                    oTargetPlayer = Utility.FindPlayer(TargetPlayerName);

                    if (oTargetPlayer == null)
                    {
                        Player.SendMessage("Player '" + TargetPlayerName + "' not found!");
                        return;
                    }
                }
                else
                {
                    oTargetPlayer = Player;
                }

                if (oTargetPlayer != null)
                {
                    oTargetPlayer.HealLife(stack);
                    oTargetPlayer.HealMana(stack);

                    //Server.notifyOps(string.Format("{0} is healing {1}", Player.Name, oTargetPlayer.Name), false);
                    Player.SendMessage(string.Format("You healed {0}", oTargetPlayer.Name));
                    oTargetPlayer.SendMessage(string.Format("You were healed by {0}", Player.Name));

                    return;
                }

            }
            catch (Exception er)
            {
                Player.SendMessage(string.Format("Command Error: {0}", er.Message));
                Program.tConsole.WriteLine(string.Format("Exception executing command from {0}: {1}", Player.Name, er.Message));
                Program.tConsole.WriteLine(string.Format("Exception Stack Trace:\n\r{0}", er.StackTrace));
            }
        }
コード例 #10
0
 public override void DisplayHints(MyPlayer player, MyEntity me)
 {
     foreach (var item in m_blocks)
     {
         if (item.Value == BlockState.MessageShown)
             continue;
         if (item.Key.SlimBlock.IsDestroyed)// already processed into BlockState.Destroyed on server as update runs before hints
             m_blocksHelper.Add(item.Key);
     }
     foreach (var block in m_blocksHelper)
     {
         if (SingleMessage != null)
             MyAPIGateway.Utilities.ShowNotification(string.Format(SingleMessage, block.CustomName), 20000, MyFontEnum.Blue);
         m_blocks[block] = BlockState.MessageShown;
     }
     m_blocksHelper.Clear();
     
     base.DisplayHints(player,me);
 }
コード例 #11
0
        public override bool Update(MyPlayer player, MyEntity me)
        {
            if (player.Identity.IsDead)
            {
                Debug.Assert(player != null);
                if (m_begin == DateTime.MinValue)
                    m_begin = DateTime.UtcNow;// + DELAY_BEFORE_SPAWN;

                if (DateTime.UtcNow - m_begin > m_limit)
                {
                    m_IsTrue = true;
                    //m_begin = DateTime.MinValue;
                }
            }
            else
            {
                m_begin = DateTime.MinValue;
            }
            return IsTrue;
        }
コード例 #12
0
 public override bool Update(MyPlayer player, MyEntity me)
 {
     bool isSomethingAlive=false;
     foreach(var item in m_blocks)
     {
         if (item.Value == BlockState.MessageShown)
             continue;
         if (item.Key.SlimBlock.IsDestroyed)
         {
             m_blocksHelper.Add(item.Key);
             continue;
         }
         isSomethingAlive = true;
     }
     if (!isSomethingAlive)
         m_IsTrue = true;
     if (m_blocksHelper.Count>0)
     {
         foreach(var block in m_blocksHelper)
             m_blocks[block] = BlockState.Destroyed;
         m_blocksHelper.Clear();
     }
     return m_IsTrue;
 }
コード例 #13
0
		public SplitScreen()
		{
			var a_to_server = new SharedClass1.Bridge();
			var server_to_a = new SharedClass1.Bridge();

			var b_to_server = new SharedClass1.Bridge();
			var server_to_b = new SharedClass1.Bridge();

			var a = new MultiPlayer.Client
			{
				Events = server_to_a,
				Messages = a_to_server
			};

			this.Lefty = a;

			var b = new MultiPlayer.Client
			{
				Events = server_to_b,
				Messages = b_to_server
			};

			this.Righty = b;

			var s = new MyGame
			{

			};





			var player_a = new MyPlayer
			{
				FromPlayer = a_to_server,
				ToPlayer = server_to_a,
				ToOthers = server_to_b,
				UserId = 0,
				Username = "******",
				AddScore = delegate { },

			};

			new SharedClass1.RemoteEvents.WithUserArgumentsRouter
			{
				user = player_a.UserId,
				Target = player_a.ToOthers
			}.CombineDelegates(a_to_server);

			var player_b = new MyPlayer
			{
				FromPlayer = b_to_server,
				ToPlayer = server_to_b,
				ToOthers = server_to_a,
				UserId = 1,
				Username = "******",
				AddScore = delegate { },

			};

			new SharedClass1.RemoteEvents.WithUserArgumentsRouter
			{
				user = player_b.UserId,
				Target = player_b.ToOthers
			}.CombineDelegates(b_to_server);




			a.InitializeEvents();
			b.InitializeEvents();

			s.GameStarted();

			a.InitializeMapOnce();
			b.InitializeMapOnce();

			s.Users.Add(player_a);
			s.UserJoined(player_a);



			s.Users.Add(player_b);
			s.UserJoined(player_b);

		}
コード例 #14
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")))
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timestopStartDelay = 120;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld");
                    zawarudo.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(zawarudo, projectile.position);
                    timestopStartDelay = 1;
                }
            }
            if (timestopStartDelay != 0)
            {
                timestopStartDelay++;
                if (timestopStartDelay >= 120)
                {
                    Timestop(5);
                    timestopPoseTimer  = 60;
                    timestopStartDelay = 0;
                }
            }
            if (timestopPoseTimer > 0)
            {
                timestopPoseTimer--;
                normalFrames           = false;
                attackFrames           = false;
                secondaryAbilityFrames = false;
                abilityPose            = true;
                Main.mouseLeft         = false;
                Main.mouseRight        = false;
                if (timestopPoseTimer <= 1)
                {
                    abilityPose = false;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    if (!secondaryAbilityFrames)
                    {
                        StayBehind();
                        projectile.direction = projectile.spriteDirection = player.direction;
                    }
                    else
                    {
                        GoInFront();
                        if (Main.MouseWorld.X > projectile.position.X)
                        {
                            projectile.spriteDirection = 1;
                            projectile.direction       = 1;
                        }
                        if (Main.MouseWorld.X < projectile.position.X)
                        {
                            projectile.spriteDirection = -1;
                            projectile.direction       = -1;
                        }
                        secondaryAbilityFrames = false;
                    }
                }
                if (Main.mouseRight && player.HasItem(mod.ItemType("Knife")) && projectile.owner == Main.myPlayer)
                {
                    Main.mouseLeft         = false;
                    secondaryAbilityFrames = true;
                    normalFrames           = false;
                    attackFrames           = false;
                    if (shootCount <= 0 && projectile.frame == 1)
                    {
                        shootCount += 28;
                        float   rotationk    = MathHelper.ToRadians(15);
                        float   numberKnives = 3;
                        Vector2 shootVel     = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= 100f;
                        for (int i = 0; i < numberKnives; i++)
                        {
                            Vector2 perturbedSpeed = new Vector2(shootVel.X, shootVel.Y).RotatedBy(MathHelper.Lerp(-rotationk, rotationk, i / (numberKnives - 1))) * .2f;
                            int     proj           = Projectile.NewProjectile(projectile.position.X + 5f, projectile.position.Y - 3f, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI);
                            Main.projectile[proj].netUpdate = true;
                            player.ConsumeItem(mod.ItemType("Knife"));
                            projectile.netUpdate = true;
                        }
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                PunchAndShootAI(mod.ProjectileType("Knife"), mod.ItemType("Knife"), true);
            }
        }
コード例 #15
0
ファイル: BeetleFortitude.cs プロジェクト: Graydee2/SpiritMod
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(mod);

            player.endurance += modPlayer.beetleStacks * 0.01f;
        }
コード例 #16
0
        private void AfterDamageApplied(object target, Sandbox.ModAPI.MyDamageInformation info)
        {
            MyCharacter targetCharacter = target as MyCharacter;

            if (targetCharacter == null || targetCharacter.IsDead)
            {
                return;
            }

            MyEntity entity = null;

            MyEntities.TryGetEntityById(info.AttackerId, out entity);

            MyPlayer     attackerPlayer = null;
            MyStringHash hitCue         = MyStringHash.NullOrEmpty;

            // Because damage system is retarded...
            if (entity is MyCharacter || entity is MyCubeGrid || entity is MyCubeBlock)
            {
                attackerPlayer = Sync.Players.GetControllingPlayer(entity);
                if (attackerPlayer == null)
                {
                    return;
                }
            }
            else
            {
                var gunBaseUser = entity as IMyGunBaseUser;
                if (gunBaseUser == null)
                {
                    return;
                }
                if (gunBaseUser.Owner == null)
                {
                    return;
                }
                attackerPlayer = Sync.Players.GetControllingPlayer(gunBaseUser.Owner);

                if (MyPerGameSettings.Game == GameEnum.ME_GAME)
                {
                    hitCue = MyStringHash.GetOrCompute("ToolCrossbHitBody");
                }
            }

            if (attackerPlayer == null || attackerPlayer.Client == null || attackerPlayer.IsBot)
            {
                return;
            }
            if (targetCharacter.ControllerInfo.Controller != null && targetCharacter.ControllerInfo.Controller.Player == attackerPlayer)
            {
                return;
            }

            if (MyPerGameSettings.Game == GameEnum.ME_GAME)
            {
                MyMultiplayer.RaiseStaticEvent(s => AfterDamageAppliedClient, hitCue, new EndpointId(attackerPlayer.Client.SteamUserId));
            }
            else if (MyPerGameSettings.Game == GameEnum.SE_GAME)
            {
                MyMultiplayer.RaiseStaticEvent(s => AfterDamageAppliedClient, hitCue, new EndpointId(attackerPlayer.Client.SteamUserId));
            }
        }
コード例 #17
0
        public override void AI()
        {
            if (scrapeFrames)
            {
                normalFrames = false;
                attackFrames = false;
                secondaryAbilityFrames = false;
            }
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player player = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer<MyPlayer>();
            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer = 0;
                projectile.netUpdate = true;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                        attackFrames = false;
                }
                if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && projectile.owner == Main.myPlayer)
                {
                    secondaryAbilityFrames = true;
                    if (chargeTimer < 150f)
                    {
                        chargeTimer++;
                    }
                }
                if (!Main.mouseRight && chargeTimer != 0 && projectile.owner == Main.myPlayer)
                {
                    scrapeFrames = true;
                }
                if (!Main.mouseRight && chargeTimer != 0 && projectile.owner == Main.myPlayer && scrapeFrames && projectile.frame == 1)
                {
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BRRR"));
                    Vector2 distanceToTeleport = Main.MouseWorld - player.position;
                    distanceToTeleport.Normalize();
                    distanceToTeleport *= chargeTimer / 45f;
                    player.velocity += distanceToTeleport * 5f;
                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(chargeTimer / 15));       //10s max cooldown
                    chargeTimer = 0;
                }
                if (SpecialKeyCurrent() && !player.HasBuff(mod.BuffType("AbilityCooldown")))
                {
                    specialTimer++;
                    secondaryAbilityFrames = true;
                }
                if (!SpecialKeyCurrent() && specialTimer != 0)
                {
                    scrapeFrames = true;
                    if (specialTimer <= 60)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BRRR"));
                        for (int i = 0; i < Main.maxNPCs; i++)
                        {
                            NPC npc = Main.npc[i];
                            if (npc.active && Collision.CheckAABBvLineCollision(npc.position, new Vector2(npc.width, npc.height), projectile.position, Main.MouseWorld) && !npc.immortal && !npc.hide && !npc.townNPC)        //checking if the NPC collides with a line from The Hand to the mouse
                            {
                                Vector2 difference = player.position - npc.position;
                                npc.position = player.Center + (-difference / 2f);
                            }
                        }
                        for (int p = 0; p < Main.maxPlayers; p++)
                        {
                            Player otherPlayer = Main.player[p];
                            if (otherPlayer.active)
                            {
                                if (otherPlayer.team != player.team && otherPlayer.whoAmI != player.whoAmI && Collision.CheckAABBvLineCollision(otherPlayer.position, new Vector2(otherPlayer.width, otherPlayer.height), projectile.position, Main.MouseWorld))
                                {
                                    Vector2 difference = player.position - otherPlayer.position;
                                    otherPlayer.position = player.Center + (-difference / 2f);
                                }
                            }
                        }
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(20));
                    }
                    if (specialTimer > 60)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BRRR"));
                        for (int i = 0; i < Main.maxNPCs; i++)
                        {
                            NPC npc = Main.npc[i];
                            if (npc.active && Collision.CheckAABBvLineCollision(npc.position, new Vector2(npc.width, npc.height), projectile.position, Main.MouseWorld) && !npc.immortal && !npc.hide && !npc.townNPC)
                            {
                                npc.StrikeNPC(60 * (specialTimer / 60), 0f, player.direction);     //damage goes up at a rate of 60dmg/s
                                npc.AddBuff(mod.BuffType("MissingOrgans"), 600);
                            }
                        }
                        for (int p = 0; p < Main.maxPlayers; p++)
                        {
                            Player otherPlayer = Main.player[p];
                            if (otherPlayer.active)
                            {
                                if (otherPlayer.team != player.team && otherPlayer.whoAmI != player.whoAmI && Collision.CheckAABBvLineCollision(otherPlayer.position, new Vector2(otherPlayer.width, otherPlayer.height), projectile.position, Main.MouseWorld))
                                {
                                    otherPlayer.Hurt(PlayerDeathReason.ByCustomReason(otherPlayer.name + " was scraped out of existence by " + player.name + "."), 60 * (specialTimer / 60), 1);
                                    otherPlayer.AddBuff(mod.BuffType("MissingOrgans"), 600);
                                }
                            }
                        }
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(30));
                    }
                    specialTimer = 0;
                }
                if (!attackFrames)
                {
                    if (!scrapeFrames && !secondaryAbilityFrames)
                        StayBehind();
                    else
                        GoInFront();
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
コード例 #18
0
ファイル: AcidPure.cs プロジェクト: ThatDeKrypT/Events
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(mod);

            modPlayer.hazmatHelm = true;
        }
コード例 #19
0
ファイル: MyTrigger.cs プロジェクト: fluxit/SpaceEngineers
 //hints are to be displayed during gameplay. This is called on both server&clients.
 public virtual void DisplayHints(MyPlayer player, Entities.MyEntity me) { }//call this only for triggers belonging to local computer!
コード例 #20
0
ファイル: DungeonSummon.cs プロジェクト: TheFirel/SpiritMod
        public override void AI()
        {
            int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 187);

            bool     flag64    = projectile.type == ModContent.ProjectileType <DungeonSummon>();
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetSpiritPlayer();

            if (flag64)
            {
                if (player.dead)
                {
                    modPlayer.DungeonSummon = false;
                }

                if (modPlayer.DungeonSummon)
                {
                    projectile.timeLeft = 2;
                }
            }

            for (int num526 = 0; num526 < 1000; num526++)
            {
                if (num526 != projectile.whoAmI && Main.projectile[num526].active && Main.projectile[num526].owner == projectile.owner && Main.projectile[num526].type == projectile.type && Math.Abs(projectile.position.X - Main.projectile[num526].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num526].position.Y) < (float)projectile.width)
                {
                    if (projectile.position.X < Main.projectile[num526].position.X)
                    {
                        projectile.velocity.X = projectile.velocity.X - 0.05f;
                    }
                    else
                    {
                        projectile.velocity.X = projectile.velocity.X + 0.05f;
                    }

                    if (projectile.position.Y < Main.projectile[num526].position.Y)
                    {
                        projectile.velocity.Y = projectile.velocity.Y - 0.05f;
                    }
                    else
                    {
                        projectile.velocity.Y = projectile.velocity.Y + 0.05f;
                    }
                }
            }

            float num527 = projectile.position.X;
            float num528 = projectile.position.Y;
            float num529 = 900f;
            bool  flag19 = false;
            int   num530 = 500;

            if (projectile.ai[1] != 0f || projectile.friendly)
            {
                num530 = 1400;
            }

            //if (Math.Abs(Projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(Projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num530)
            //{
            //	projectile.ai[0] = 1f;
            //}
            if (projectile.ai[0] == 0f)
            {
                for (int num531 = 0; num531 < 200; num531++)
                {
                    if (Main.npc[num531].CanBeChasedBy(projectile, false))
                    {
                        float num532 = Main.npc[num531].position.X + (float)(Main.npc[num531].width / 2);
                        float num533 = Main.npc[num531].position.Y + (float)(Main.npc[num531].height / 2);
                        float num534 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num532) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num533);
                        if (num534 < num529 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num531].position, Main.npc[num531].width, Main.npc[num531].height))
                        {
                            num529 = num534;
                            num527 = num532;
                            num528 = num533;
                            flag19 = true;
                        }
                    }
                }
            }
            else
            {
                projectile.tileCollide = false;
            }

            if (!flag19)
            {
                projectile.friendly = true;
                float num535 = 8f;
                if (projectile.ai[0] == 1f)
                {
                    num535 = 12f;
                }

                Vector2 vector38 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
                float   num536   = Main.player[projectile.owner].Center.X - vector38.X;
                float   num537   = Main.player[projectile.owner].Center.Y - vector38.Y - 60f;
                float   num538   = (float)Math.Sqrt((double)(num536 * num536 + num537 * num537));
                if (num538 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
                {
                    projectile.ai[0] = 0f;
                }
                if (num538 > 2000f)
                {
                    projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
                    projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2);
                }
                if (num538 > 70f)
                {
                    num538  = num535 / num538;
                    num536 *= num538;
                    num537 *= num538;
                    projectile.velocity.X = (projectile.velocity.X * 20f + num536) / 21f;
                    projectile.velocity.Y = (projectile.velocity.Y * 20f + num537) / 21f;
                }
                else
                {
                    if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
                    {
                        projectile.velocity.X = -0.15f;
                        projectile.velocity.Y = -0.05f;
                    }
                    projectile.velocity *= 1.01f;
                }
                projectile.friendly = false;
                projectile.rotation = projectile.velocity.X * 0.05f;
                if (Math.Abs(projectile.velocity.X) > 0.2)
                {
                    projectile.spriteDirection = -projectile.direction;
                    return;
                }
            }
            else
            {
                if (projectile.ai[1] == -1f)
                {
                    projectile.ai[1] = 17f;
                }

                if (projectile.ai[1] > 0f)
                {
                    projectile.ai[1] -= 1f;
                }

                if (projectile.ai[1] == 0f)
                {
                    projectile.friendly = true;
                    float   num539   = 8f;
                    Vector2 vector39 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
                    float   num540   = num527 - vector39.X;
                    float   num541   = num528 - vector39.Y;
                    float   num542   = (float)Math.Sqrt((double)(num540 * num540 + num541 * num541));
                    if (num542 < 100f)
                    {
                        num539 = 10f;
                    }

                    num542  = num539 / num542;
                    num540 *= num542;
                    num541 *= num542;
                    projectile.velocity.X = (projectile.velocity.X * 14f + num540) / 15f;
                    projectile.velocity.Y = (projectile.velocity.Y * 14f + num541) / 15f;
                }
                else
                {
                    projectile.friendly = false;
                    if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f)
                    {
                        projectile.velocity *= 1.05f;
                    }
                }

                projectile.rotation = projectile.velocity.X * 0.05f;
                projectile.frameCounter++;
                if (projectile.frameCounter >= 4)
                {
                    projectile.frameCounter = 0;
                    projectile.frame++;
                }
                if (projectile.frame < 4)
                {
                    projectile.frame = 4;
                }
                else if (projectile.frame > 7)
                {
                    projectile.frame = 4;
                }

                if (Math.Abs(projectile.velocity.X) > 0.2)
                {
                    projectile.spriteDirection = -projectile.direction;
                    return;
                }
            }

            if (projectile.frameCounter < 8)
            {
                projectile.frame = 0;
            }
            else if (projectile.frameCounter >= 8 && projectile.frameCounter < 10)
            {
                projectile.frame = 1;
            }
            else
            {
                projectile.frameCounter = 0;
            }
            projectile.frameCounter++;
        }
コード例 #21
0
 public override bool UseItem(Player player)
 {
     MyPlayer.ModPlayer(player).KaioFragment2 = true;
     return(true);
 }
コード例 #22
0
ファイル: KiEssence3.cs プロジェクト: wtfwotefa/DBZMOD
 public override bool UseItem(Player player)
 {
     MyPlayer.ModPlayer(player).kiChargeRate += 2;
     MyPlayer.ModPlayer(player).kiEssence3    = true;
     return(true);
 }
コード例 #23
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            Player   player  = Main.player[projectile.owner];
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            secondaryAbilityFrames = player.ownedProjectileCounts[mod.ProjectileType("BlackHole")] != 0;
            //Lighting.AddLight((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f), 0.6f, 0.9f, 0.3f);
            //Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 35, projectile.velocity.X * -0.5f, projectile.velocity.Y * -0.5f);

            if (shootCount > 0)
            {
                shootCount--;
            }
            if (mPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (player.ownedProjectileCounts[mod.ProjectileType("BlackHole")] == 0)
            {
                blackHoleWhoAmI = -1;
            }
            if (!secondaryAbilityFrames)
            {
                StayBehind();
            }
            else
            {
                projectile.velocity = Vector2.Zero;
                projectile.position = Main.projectile[blackHoleWhoAmI].Center - new Vector2(0f, -300f);
            }

            /*if (blackHoleWhoAmI == 0 && player.ownedProjectileCounts[mod.ProjectileType("BlackHole")] != 0)
             * {
             *  blackHoleWhoAmI = BlackHole.whoAmI;
             * }*/

            if (Main.mouseLeft && !secondaryAbilityFrames)
            {
                attackFrames = true;
                if (shootCount <= 0)
                {
                    Main.PlaySound(SoundID.Item78, projectile.position);
                    shootCount += newShootTime;
                    Vector2 shootVel = Main.MouseWorld - projectile.Center;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, 1f);
                    }
                    shootVel.Normalize();
                    shootVel *= 1.5f;
                    Vector2 perturbedSpeed = new Vector2(shootVel.X, shootVel.Y);
                    int     proj           = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BackInBlackOrb"), newProjectileDamage, 2f, player.whoAmI);
                    Main.projectile[proj].netUpdate = true;
                    projectile.netUpdate            = true;
                }
            }
            if (!Main.mouseLeft && !secondaryAbilityFrames)
            {
                normalFrames = true;
                attackFrames = false;
            }
            if (Main.mouseRight && shootCount <= 0 && player.whoAmI == Main.myPlayer && !secondaryAbilityFrames)
            {
                if (player.ownedProjectileCounts[mod.ProjectileType("TeleportationWormhole")] == 0)
                {
                    wormholeWhoAmI = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, mod.ProjectileType("TeleportationWormhole"), 0, 0f, player.whoAmI);
                    shootCount    += 60;
                }
                else
                {
                    Projectile wormhole = Main.projectile[wormholeWhoAmI];
                    player.position = wormhole.position;
                    wormholeWhoAmI  = -1;
                    wormhole.Kill();
                    shootCount += 60;
                }
            }
            if (SpecialKeyCurrent())
            {
                if (player.ownedProjectileCounts[mod.ProjectileType("BlackHole")] == 0 && blackHoleWhoAmI == -1)
                {
                    blackHoleWhoAmI = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 300f, 0f, 0f, mod.ProjectileType("BlackHole"), 0, 0f, player.whoAmI);
                    Main.projectile[blackHoleWhoAmI].scale     = 0.05f;
                    Main.projectile[blackHoleWhoAmI].netUpdate = true;
                }
                else
                {
                    Main.projectile[blackHoleWhoAmI].scale    += 0.003f;
                    Main.projectile[blackHoleWhoAmI].timeLeft += 2;
                }
            }
            if (!SpecialKeyCurrent() && secondaryAbilityFrames)
            {
                Main.projectile[blackHoleWhoAmI].scale -= 0.005f;
            }
        }
コード例 #24
0
ファイル: DazeGlyphBuff.cs プロジェクト: Graydee2/SpiritMod
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(mod);

            modPlayer.dazeGlyph = true;
        }
コード例 #25
0
	void Awake()
	{
		m_curStageIdx = LevelData.curDungeonId % 3;

		//current_costume = Crypto.Load_int_key("n05");
		bosskill = PlayerPrefsX.GetIntArray ("bosskill");
		cur_difficulty = Crypto.Load_int_key("n14");
		//Debug.Log(cur_difficulty);
		script_stageDB = GetComponent<DB_Stage>();
		int cur_stage_kind =Crypto.Load_int_key("cur_stage_kind");
		cur_stage_index  = (short)Crypto.Load_int_key("cur_stage_index");
		infinity_stage_index = (short)(cur_stage_index%90);
		play_kind = Crypto.Load_int_key("play_kind");
		cur_general = Crypto.Load_int_key("cur_general");
		
		GameObject cha1 = GameObject.FindWithTag("Player");
		script_cha = cha1.GetComponent<MyPlayer>();
		
		//script_generalstat = GetComponent<General_Stat>();
		///script_iconskill = GameObject.FindWithTag("icon_skill").GetComponent<Icon_Skill>();

		if (cur_stage_kind == 11)
		{
			cur_difficulty = 0;
			infinitymode = true;
			wave = Crypto.Load_int_key("n49");
			//wave = 26;
			cur_stage_index = (short)( 2 + 3*(wave-1));
			infinity_stage_index = (short)(cur_stage_index%90);
			
			GameObject gate = Resources.Load("dun_gate") as GameObject;
			c_dun_door = (Transform)Instantiate(gate.transform, Vector3.up*55 ,Quaternion.identity);
			
			set_spawndelay = 0.4f;
			finalstage = 1000;
			WAVEEMEMYNUM = 80;
		}
		else
		{
			if (play_kind == 5)			//boss
			{
				SetMapStory(cur_stage_kind,false);
				bossremain = script_stageDB.st[cur_stage_index]._bosscount;
				finalstage = 1;
				WAVEEMEMYNUM = 120;
			}
			if (play_kind == 6)			//cart
			{
				SetMapStory(cur_stage_kind,true);
				collider_ground.position = new Vector3 (0,-0.01f,3);
				collider_ground.localScale = new Vector3 (1,0,6);
				cur_general = -1;
				c_extraunit = (Transform)Instantiate(cart,Vector3.forward *0.5f,Quaternion.identity);
				general_portrait.gameObject.active = true;
				general_portrait.GetComponent<Renderer>().material.mainTexture = Resources.Load("prt_cart") as Texture;
				set_spawndelay = 6.5f - (cur_stage_index *0.03f);
				finalstage = 1;
				WAVEEMEMYNUM = 250;
			}
			else if (play_kind == 7)			//castle
			{
				SetMapStory(cur_stage_kind,true);
				
				collider_ground.position = new Vector3 (0,-0.01f,3);
				collider_ground.localScale = new Vector3 (1,0,6);
				//cur_general = -1;
				for (int i = 0; i<3; ++i)
				{
					c_tower[2*i] = (Transform)Instantiate(tower,Vector3.forward *(i*3)+Vector3.forward*3 - Vector3.right*0.5f,Quaternion.Euler(0,45,0));
					c_tower[2*i+1] = (Transform)Instantiate(tower,Vector3.forward *(i*3)+Vector3.forward*3 + Vector3.right*0.5f,Quaternion.Euler(0,45,0));
					c_barrack[2*i] = (Transform)Instantiate(barrack,Vector3.forward *(i*3)+Vector3.forward*2+Vector3.right*0.4f ,Quaternion.Euler(0,225,0));
					c_barrack[2*i+1] = (Transform)Instantiate(barrack,Vector3.forward *(i*3)+Vector3.forward*1-Vector3.right*0.4f ,Quaternion.Euler(0,-225,0));
				}
				c_basecamp = (Transform)Instantiate (basecamp,Vector3.forward *10 ,Quaternion.identity);
				c_tank = (Transform)Instantiate (tank, Vector3.forward *(-0.5f), Quaternion.Euler(0,180,0));

				set_spawndelay = 3;
				c_stage.Find("amap").GetComponent<Renderer>().material.SetTexture("_LightMap",lightmap_tank);
				InvokeRepeating ("RegenAlly",2,2f);
				finalstage = 1;
				WAVEEMEMYNUM = 250;
			}
			else
			{
				SetMapStory(cur_stage_kind,false);
				finalstage = 3;//script_stageDB.st[cur_stage_index]._stagenum;
				WAVEEMEMYNUM = 60;
//				if(cur_stage_index ==0 )
//				{
//					WAVEEMEMYNUM = 40;
//				}
			}
			rewardkind = script_stageDB.st[infinity_stage_index]._reward;
			//Debug.Log(rewardkind);
		}

//		if (cur_general != -1)
//		{
//			script_DBgeneral = GetComponent<DB_General>();
//			int[] general_seed = new int[6];
//			general_seed = PlayerPrefsX.GetIntArray("n13");
//			general_hp = PlayerPrefsX.GetIntArray("n33");
//			GeneralHP(true);
//			
//			int cur_seed = general_seed[cur_general];
//			
//		//	script_generalstat.SetGeneral(cur_seed);
//			short general_kind = script_generalstat.general_kind;
//			short g_maxhp = script_generalstat.g_maxhp;
//			g_grade = script_generalstat.g_grade;
//			int g_hp = general_hp[cur_general];
//			if (g_hp> g_maxhp)
//				g_hp= g_maxhp;
//			general_index = script_generalstat.general_index;
//			////////test
//			//general_index = 16;
//			//general_kind = (short)(general_index%5);
//			////////
//			short g_maxatk =  script_generalstat.g_maxatk;
//			float g_atkspd =  script_generalstat.g_atkspd;
//			
//			float g_skillcooltime = script_DBgeneral.gs[general_index]._cooltime - g_atkspd * 40;
//			short g_soulcost = script_DBgeneral.gs[general_index]._soulcost;
//			if (infinitymode)
//				g_soulcost = 0;
//			short g_voice = script_DBgeneral.gs[general_index]._voice;
//			
//			//////////////////////////////////////
//			
////			script_cha.Set_General(
////				            script_DBgeneral.gs[general_index]._weapon,
////				          	general_kind,
////				            g_maxhp,
////				            g_maxatk,
////				            script_generalstat.g_def,
////				            g_atkspd,
////				            script_generalstat.g_unique,
////				            g_hp,
////							g_voice
////					);
////			
//			if (g_grade < 2)
//			{
//				//Todo Lee
//				///Destroy(general_portrait.GetChild(0).gameObject);
//			}
//			else
//			{
//				///cha1.GetComponent<Char_Skill>().Set_General_Skill(g_maxatk,script_DBgeneral.gs[general_index]._skillatk ,script_DBgeneral.gs[general_index]._skillkind);
//				///script_iconskill.Set_General(g_soulcost,g_skillcooltime,general_kind,infinitymode);
//			}
//			//Debug.Log(script_DBgeneral.gs[general_index]._skillatk);
//			//////////////////////////////////////
//			///general_portrait.gameObject.active = true;
//			prt_general = Resources.Load("prt_general" +(general_index+1).ToString()) as Texture;
//			prt_cha = Resources.Load("prt_cha") as Texture;
//			///general_portrait.renderer.material.mainTexture = prt_general;
//			
//			//if (current_costume == general_kind+11)
//				//g_soulcost = 0;
//
//			///general_portrait.GetChild(0).GetComponent<Icon_Skill_p>().SkillKind(0,general_index,0,g_soulcost);
//			
//			if (cur_difficulty !=2)
//			{
//				///g_hpgauge = GameObject.FindWithTag("p_plan").GetComponent<MakeUI>().
//				///CreatCustomPlane(new Vector2(0.24f,0.08f),0,new Vector3 (-1.39f,2.36f,1.8f),new Vector2(0.75f,0.625f),new Vector2(0.875f,0.6875f),"general_hp","Gauge_UV",0.1f ,0);
//				///script_g_hpgauge = g_hpgauge.GetComponent<Gauge_UV>();
//				///g_hp_length = (1-(float)g_hp/(float)g_maxhp)*0.125f;
//				///script_g_hpgauge.UvMove(Vector2.right * g_hp_length);
//			}
//		}
		//cur_stage_index  = (short)(cur_stage_index/3);
	}
コード例 #26
0
 internal void NotifyPlayerDisconnect(MyPlayer player) => connectedPlayers.Remove(player.Id.SteamId.ToString());
コード例 #27
0
ファイル: SpiritBombBall.cs プロジェクト: minionmn/DBZMOD
        public override void AI()
        {
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            if (!_isInitialized)
            {
                modPlayer.isMassiveBlastCharging = true;
                //modPlayer.isMassiveBlastInUse = true;
                HeldTime       = 1;
                _isInitialized = true;
            }

            // cancel channeling if the projectile is maxed
            if (projectile.scale > 12 && player.channel)
            {
                player.channel = false;
            }

            if (player.channel && modPlayer.isMassiveBlastCharging)
            {
                projectile.scale    = BASE_SCALE + SCALE_INCREASE * (HeldTime / 2.5f);
                projectile.position = player.Center + new Vector2(0, -20 - (projectile.scale * 17));
                HeldTime++;

                // reduced from 25.
                for (int d = 0; d < 15; d++)
                {
                    // loop hitch for variance.
                    if (Main.rand.NextFloat() < 0.3f)
                    {
                        continue;
                    }

                    float   angle    = Main.rand.NextFloat(360);
                    float   angleRad = MathHelper.ToRadians(angle);
                    Vector2 position = new Vector2((float)Math.Cos(angleRad), (float)Math.Sin(angleRad));

                    Dust tDust = Dust.NewDustDirect(projectile.position + (position * (20 + 12.5f * projectile.scale)), projectile.width, projectile.height, 15, 0f, 0f, 213, default(Color), 2.0f);
                    tDust.velocity  = Vector2.Normalize((projectile.position + (projectile.Size / 2)) - tDust.position) * 2;
                    tDust.noGravity = true;
                }

                //Rock effect
                if (DBZMOD.IsTickRateElapsed(10) && _rocksFloating < MAX_ROCKS)
                {
                    // only some of the time, keeps it a little more varied.
                    if (Main.rand.NextFloat() < 0.6f)
                    {
                        _rocksFloating++;
                        BaseFloatingDestructionProj.SpawnNewFloatingRock(player, projectile);
                    }
                }

                if (projectile.timeLeft < 399)
                {
                    projectile.timeLeft = 400;
                }

                MyPlayer.ModPlayer(player).AddKi(-2, true, false);
                player.ApplyChannelingSlowdown();

                // depleted check, release the ball
                if (MyPlayer.ModPlayer(player).IsKiDepleted())
                {
                    player.channel = false;
                }
                if (_soundtimer == 0)
                {
                    _soundInfo = SoundHelper.PlayCustomSound("Sounds/SpiritBombCharge", player, 0.5f);
                }
                _soundtimer++;
                if (_soundtimer > 120)
                {
                    _soundtimer = 0;
                }
            }
            else if (modPlayer.isMassiveBlastCharging)
            {
                modPlayer.isMassiveBlastCharging = false;
                float projectileWidthFactor = projectile.width * projectile.scale / TRAVEL_SPEED_COEFFICIENT;
                projectile.timeLeft    = (int)Math.Ceiling(projectileWidthFactor) + 180;
                projectile.velocity    = Vector2.Normalize(Main.MouseWorld - player.Center) * TRAVEL_SPEED_COEFFICIENT;
                projectile.tileCollide = false;
                projectile.damage     *= (int)projectile.scale / 2;
                _soundInfo             = SoundHelper.KillTrackedSound(_soundInfo);
                SoundHelper.PlayCustomSound("Sounds/SpiritBombFire", player);
            }
            projectile.netUpdate  = true;
            projectile.netUpdate2 = true;
        }
コード例 #28
0
ファイル: MythrilGlasses.cs プロジェクト: JaymenL/DBZMOD
 public override void UpdateArmorSet(Player player)
 {
     player.setBonus = "Ki orbs regenerate twice as much ki.";
     MyPlayer.ModPlayer(player).OrbHealAmount *= 2;
 }
コード例 #29
0
 public static int CountAvailable(MyPlayer playerId)
 {
     return Sync.Players.RespawnComponent.CountAvailableSpawns(playerId);
 }
コード例 #30
0
 public virtual bool CanSee(MyPlayer player)
 {
     return(true);
 }
コード例 #31
0
 public bool UpdateWin(MyPlayer player, MyEntity me)
 {
     if (Won || Lost)
         return true;
     for (int i=0;i<m_winTriggers.Count;i++)
     {
         var trigger=m_winTriggers[i];
         if (trigger.IsTrue || trigger.Update(player, me))
         { //Won!
             SetPlayerWon(player.Id, i);
             return true;
         }
     }
     return false;
 }
コード例 #32
0
        public override void AI()
        {
            SelectFrame();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }

                if (projectile.owner == Main.myPlayer)
                {
                    if (JoJoStands.SpecialHotKey.JustPressed)
                    {
                        modPlayer.GEAbilityNumber += 1;
                        saidAbility = false;
                    }
                    if (modPlayer.GEAbilityNumber >= 3)
                    {
                        modPlayer.GEAbilityNumber = 0;
                    }
                    if (modPlayer.GEAbilityNumber == 0)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Frog");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 1)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Tree");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 2)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Butterflies");
                            saidAbility = true;
                        }
                    }

                    if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 0)
                    {
                        Main.mouseLeft = false;
                        int proj = Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType("GEFrog"), 1, 0f, Main.myPlayer, tierNumber, tierNumber - 1f);
                        Main.projectile[proj].netUpdate = true;
                        player.AddBuff(mod.BuffType("AbilityCooldown"), 360);
                    }
                    if (Main.mouseRight && Collision.SolidCollision(Main.MouseWorld, 1, 1) && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 1)
                    {
                        Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y - 65f, 0f, 0f, mod.ProjectileType("GETree"), 1, 0f, Main.myPlayer, tierNumber);
                        player.AddBuff(mod.BuffType("AbilityCooldown"), 720);
                    }
                    if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 2)
                    {
                        Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("GEButterfly"), 1, 0f, Main.myPlayer);
                        player.AddBuff(mod.BuffType("AbilityCooldown"), 720);
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
コード例 #33
0
        public override void AI()
        {
            SelectFrame();
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (!attackFrames)
            {
                StayBehind();
            }
            else
            {
                GoInFront();
            }

            if (player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0)
            {
                abilityPose = false;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0)
                {
                    attackFrames         = true;
                    Main.mouseRight      = false;
                    projectile.netUpdate = true;
                    if (shootCount <= 0)
                    {
                        shootCount += shootTime - modPlayer.standSpeedBoosts;
                        Vector2 shootVel = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= shootSpeed;
                        int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("FireAnkh"), (int)(projectileDamage * modPlayer.standDamageBoosts), 3f, Main.myPlayer, chanceToDebuff, debuffDuration);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                    }
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        normalFrames = true;
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0)
                {
                    abilityPose          = true;
                    Main.mouseLeft       = false;
                    projectile.netUpdate = true;
                    Vector2 shootVel = Main.MouseWorld - projectile.Center;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, 1f);
                    }
                    shootVel.Normalize();
                    shootVel *= 16f;
                    int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("RedBind"), (int)(projectileDamage * modPlayer.standDamageBoosts), 3f, Main.myPlayer, projectile.whoAmI, debuffDuration - 60);
                    Main.projectile[proj].netUpdate = true;
                    projectile.netUpdate            = true;
                }
                if (JoJoStands.SpecialHotKey.JustPressed && !player.HasBuff(mod.BuffType("AbilityCooldown")) && projectile.owner == Main.myPlayer)
                {
                    player.AddBuff(mod.BuffType("AbilityCooldown"), 1500);
                    for (int p = 1; p <= 50; p++)
                    {
                        float   radius = p * 5;
                        Vector2 offset = player.Center + (radius.ToRotationVector2() * 48f);
                        int     proj   = Projectile.NewProjectile(offset.X, offset.Y, 0f, 0f, mod.ProjectileType("CrossfireHurricaneAnkh"), (int)(projectileDamage * modPlayer.standDamageBoosts), 5f, Main.myPlayer, 48f, radius);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                NPC     target     = null;
                Vector2 targetPos  = projectile.position;
                float   targetDist = 350f;
                if (target == null)
                {
                    for (int k = 0; k < 200; k++)       //the targeting system
                    {
                        NPC npc = Main.npc[k];
                        if (npc.CanBeChasedBy(this, false))
                        {
                            float distance = Vector2.Distance(npc.Center, player.Center);
                            if (distance < targetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                            {
                                if (npc.boss)       //is gonna try to detect bosses over anything
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                                else        //if it fails to detect a boss, it'll detect the next best thing
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                            }
                        }
                    }
                }
                if (target != null)
                {
                    attackFrames = true;
                    normalFrames = false;
                    if ((targetPos - projectile.Center).X > 0f)
                    {
                        projectile.spriteDirection = projectile.direction = 1;
                    }
                    else if ((targetPos - projectile.Center).X < 0f)
                    {
                        projectile.spriteDirection = projectile.direction = -1;
                    }
                    if (targetPos.X > projectile.position.X)
                    {
                        projectile.velocity.X = 4f;
                    }
                    if (targetPos.X < projectile.position.X)
                    {
                        projectile.velocity.X = -4f;
                    }
                    if (targetPos.Y > projectile.position.Y)
                    {
                        projectile.velocity.Y = 4f;
                    }
                    if (targetPos.Y < projectile.position.Y)
                    {
                        projectile.velocity.Y = -4f;
                    }
                    if (shootCount <= 0)
                    {
                        if (Main.myPlayer == projectile.owner)
                        {
                            shootCount += shootTime - modPlayer.standSpeedBoosts;
                            Vector2 shootVel = targetPos - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            shootVel *= shootSpeed;
                            int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("FireAnkh"), (int)(projectileDamage * modPlayer.standDamageBoosts), 3f, Main.myPlayer, chanceToDebuff, debuffDuration);
                            Main.projectile[proj].netUpdate = true;
                            projectile.netUpdate            = true;
                        }
                    }
                }
                else
                {
                    normalFrames = true;
                    attackFrames = false;
                }
            }
        }
コード例 #34
0
        public static Boolean StorePatchMethod(MyStoreBlock __instance, long id, int amount, long targetEntityId, MyPlayer player, MyAccountInfo playerAccountInfo)
        {
            MyStoreItem storeItem = (MyStoreItem)null;
            bool        proceed   = false;

            foreach (MyStoreItem playerItem in __instance.PlayerItems)
            {
                MyCubeGrid grid = __instance.CubeGrid;
                if (FacUtils.GetFactionTag(FacUtils.GetOwner(grid)) != null && FacUtils.GetFactionTag(FacUtils.GetOwner(grid)).Length > 3 && TruckingPlugin.config.NPCGridContracts)
                {
                    proceed = true;
                }
                if (!grid.Editable || !grid.DestructibleBlocks)
                {
                    proceed = true;
                }

                if (__instance.DisplayNameText != null && __instance.DisplayNameText.ToLower().Contains("hauling contracts") && proceed)
                {
                    if (playerItem.Id == id)
                    {
                        storeItem = playerItem;
                        break;
                    }
                }
            }
            //this does things
            if (storeItem != null && proceed)
            {
                if (MyBankingSystem.GetBalance(player.Identity.IdentityId) >= storeItem.PricePerUnit)
                {
                    //if it cant generate a contract, return false
                    if (!TruckingPlugin.GenerateContract(player.Id.SteamId, player.Identity.IdentityId))
                    {
                        return(false);
                    }
                    else
                    {
                        //do the money transfers then return false so the item stays in the store
                        MyBankingSystem.ChangeBalance(player.Identity.IdentityId, (storeItem.PricePerUnit * -1));
                        MyBankingSystem.ChangeBalance(__instance.OwnerId, storeItem.PricePerUnit);
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #35
0
 public override bool UseItem(Player player)
 {
     MyPlayer.ModPlayer(player).MasteryLevel3 = Math.Min(1.0f, MyPlayer.ModPlayer(player).MasteryLevel3 + 0.25f);
     return(true);
 }
コード例 #36
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            if (timeAfterTouch > 0)
            {
                timeAfterTouch--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (projectile.spriteDirection == 1)
            {
                drawOffsetX = -10;
            }
            if (projectile.spriteDirection == -1)
            {
                drawOffsetX = -60;
            }
            drawOriginOffsetY = -halfStandHeight;
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
                if (Main.mouseRight && shootCount <= 0 && timeAfterTouch <= 0 && projectile.owner == Main.myPlayer)
                {
                    shootCount    += 5;
                    Main.mouseLeft = false;
                    attackFrames   = false;
                    normalFrames   = false;

                    if (!touchedNPC && !touchedTile)
                    {
                        if (mouseToPlayerDistance < maxAltDistance)
                        {
                            bool foundNPCTarget = false;
                            for (int n = 0; n < Main.maxNPCs; n++)
                            {
                                NPC npc = Main.npc[n];
                                if (npc.active)
                                {
                                    if (npc.Distance(Main.MouseWorld) <= (npc.width / 2f) + 20f)
                                    {
                                        touchedNPC     = true;
                                        timeAfterTouch = 60;
                                        foundNPCTarget = true;
                                        npc.GetGlobalNPC <JoJoGlobalNPC>().taggedByKillerQueen = true;
                                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick"));
                                        break;
                                    }
                                }
                            }
                            if (!foundNPCTarget)
                            {
                                if (Collision.SolidCollision(Main.MouseWorld, 1, 1) && !touchedTile)
                                {
                                    touchedTile    = true;
                                    timeAfterTouch = 60;
                                    savedPosition  = Main.MouseWorld;
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick"));
                                }
                            }
                        }
                    }
                    else
                    {
                        if (touchedNPC)
                        {
                            for (int n = 0; n < Main.maxNPCs; n++)
                            {
                                NPC npc = Main.npc[n];
                                if (npc.active)
                                {
                                    JoJoGlobalNPC jojoNPC = npc.GetGlobalNPC <JoJoGlobalNPC>();
                                    if (jojoNPC.taggedByKillerQueen)
                                    {
                                        touchedNPC = false;
                                        int projectile = Projectile.NewProjectile(npc.position, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 50f, player.whoAmI);
                                        Main.projectile[projectile].friendly  = true;
                                        Main.projectile[projectile].timeLeft  = 2;
                                        Main.projectile[projectile].netUpdate = true;
                                        jojoNPC.taggedByKillerQueen           = false;
                                        break;
                                    }
                                }
                            }
                        }
                        if (touchedTile)
                        {
                            touchedTile            = false;
                            secondaryAbilityFrames = true;
                            int projectile = Projectile.NewProjectile(savedPosition, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 50f, player.whoAmI);
                            Main.projectile[projectile].friendly  = true;
                            Main.projectile[projectile].timeLeft  = 2;
                            Main.projectile[projectile].netUpdate = true;
                            savedPosition = Vector2.Zero;
                        }
                    }
                }
                else
                {
                    secondaryAbilityFrames = false;
                }
                if (SpecialKeyPressed() && player.ownedProjectileCounts[mod.ProjectileType("SheerHeartAttack")] == 0)
                {
                    Projectile.NewProjectile(projectile.position.X + 10f * projectile.direction, projectile.position.Y, 0f, 0f, mod.ProjectileType("SheerHeartAttack"), 1, 0f, projectile.owner, 0f);
                }
            }
            if (modPlayer.StandAutoMode)
            {
                NPC     target    = null;
                Vector2 targetPos = projectile.position;
                if (npcExplosionTimer >= 0)
                {
                    npcExplosionTimer--;
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
                float targetDist = maxDistance * 1.5f;
                if (target == null)
                {
                    for (int k = 0; k < 200; k++)       //the targeting system
                    {
                        NPC npc = Main.npc[k];
                        if (npc.CanBeChasedBy(this, false))
                        {
                            float distance = Vector2.Distance(npc.Center, player.Center);
                            if (distance < targetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                            {
                                if (npc.boss)       //is gonna try to detect bosses over anything
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                                else        //if it fails to detect a boss, it'll detect the next best thing
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                            }
                        }
                    }
                }
                float touchedTargetDistance = 0f;
                if (savedTarget != null)
                {
                    touchedTargetDistance = Vector2.Distance(player.Center, savedTarget.Center);
                    if (!savedTarget.active)
                    {
                        savedTarget = null;
                    }
                }
                if (savedTarget == null)
                {
                    explosionTimer    = 0;
                    npcExplosionTimer = 0;
                }
                if (savedTarget != null && touchedTargetDistance > newMaxDistance + 8f && npcExplosionTimer <= 0)       //if the target leaves and the bomb won't damage you, detonate the enemy
                {
                    secondaryAbilityFrames = true;
                    attackFrames           = false;
                    normalFrames           = false;
                    explosionTimer++;
                    if (explosionTimer == 5)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick"));
                    }
                    if (explosionTimer >= 90)
                    {
                        int bomb = Projectile.NewProjectile(savedTarget.position, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 3f, projectile.owner);
                        Main.projectile[bomb].timeLeft  = 2;
                        Main.projectile[bomb].netUpdate = true;
                        explosionTimer    = 0;
                        npcExplosionTimer = 360;
                        savedTarget       = null;
                    }
                }
                if (target != null)
                {
                    attackFrames = true;
                    normalFrames = false;
                    if ((targetPos - projectile.Center).X > 0f)
                    {
                        projectile.spriteDirection = projectile.direction = 1;
                    }
                    else if ((targetPos - projectile.Center).X < 0f)
                    {
                        projectile.spriteDirection = projectile.direction = -1;
                    }
                    Vector2 velocity = targetPos - projectile.position;
                    velocity.Normalize();
                    projectile.velocity = velocity * 4f;
                    if (shootCount <= 0)
                    {
                        if (Main.myPlayer == projectile.owner)
                        {
                            shootCount += newPunchTime;
                            Vector2 shootVel = targetPos - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            if (projectile.direction == 1)
                            {
                                shootVel *= shootSpeed;
                            }
                            int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Fists"), (int)(newPunchDamage * 0.9f), 3f, projectile.owner, fistWhoAmI, tierNumber);
                            Main.projectile[proj].netUpdate = true;
                            projectile.netUpdate            = true;
                        }
                    }
                }
                else
                {
                    normalFrames = true;
                    attackFrames = false;
                }
            }
            if (!touchedTile)
            {
                mouseToPlayerDistance = Vector2.Distance(Main.MouseWorld, player.Center);
            }
            if (touchedTile && MyPlayer.AutomaticActivations)
            {
                for (int i = 0; i < 200; i++)
                {
                    npcDistance = Vector2.Distance(Main.npc[i].Center, savedPosition);
                    if (npcDistance < 50f && touchedTile)       //or youd need to go from its center, add half its width to the direction its facing, and then add 16 (also with direction) -- Direwolf
                    {
                        int bomb = Projectile.NewProjectile(savedPosition, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 50f, projectile.owner);
                        Main.projectile[bomb].friendly  = true;
                        Main.projectile[bomb].timeLeft  = 2;
                        Main.projectile[bomb].netUpdate = true;
                        touchedTile   = false;
                        savedPosition = Vector2.Zero;
                    }
                }
            }
        }
コード例 #37
0
        public override void AI()
        {
            projectile.frameCounter++;
            if (projectile.frameCounter > 4)
            {
                projectile.frame++;
                projectile.frameCounter = 0;
            }
            if (projectile.frame > 3)
            {
                projectile.frame = 0;
            }
            bool     flag64    = projectile.type == mod.ProjectileType("Overgrowth");
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(mod);

            if (flag64)
            {
                if (player.dead)
                {
                    modPlayer.OG = false;
                }
                if (modPlayer.OG)
                {
                    projectile.timeLeft = 2;
                }
            }
            projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
            projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f;
            if (Main.player[projectile.owner].gravDir == -1f)
            {
                projectile.position.Y = projectile.position.Y + 120f;
                projectile.rotation   = 3.14f;
            }
            else
            {
                projectile.rotation = 0f;
            }
            projectile.position.X = (float)((int)projectile.position.X);
            projectile.position.Y = (float)((int)projectile.position.Y);
            float num395 = (float)Main.mouseTextColor / 200f - 0.35f;

            num395          *= 0.2f;
            projectile.scale = num395 + 0.95f;
            if (projectile.owner == Main.myPlayer)
            {
                if (projectile.ai[0] != 0f)
                {
                    projectile.ai[0] -= 1f;
                    return;
                }
                float num396 = projectile.position.X;
                float num397 = projectile.position.Y;
                float num398 = 700f;
                bool  flag11 = false;
                for (int num399 = 0; num399 < 200; num399++)
                {
                    if (Main.npc[num399].CanBeChasedBy(projectile, true))
                    {
                        float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2);
                        float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2);
                        float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401);
                        if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height))
                        {
                            num398 = num402;
                            num396 = num400;
                            num397 = num401;
                            flag11 = true;
                        }
                    }
                }
                if (flag11)
                {
                    float   num403   = 6f;                 //modify the speed the projectile are shot.  Lower number = slower projectile.
                    Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
                    float   num404   = num396 - vector29.X;
                    float   num405   = num397 - vector29.Y;
                    float   num406   = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405));
                    num406  = num403 / num406;
                    num404 *= num406;
                    num405 *= num406;
                    Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, mod.ProjectileType("OvergrowthLeaf"), projectile.damage, projectile.damage, projectile.owner, 0f, 0f);
                    projectile.ai[0] = 50f;
                    return;
                }
            }
        }
コード例 #38
0
ファイル: BukuujutsuGuide.cs プロジェクト: JaymenL/DBZMOD
 public override bool UseItem(Player player)
 {
     MyPlayer.ModPlayer(player).flightUnlocked = true;
     Main.NewText("You have unlocked flight.");
     return(true);
 }
コード例 #39
0
ファイル: Caltfist.cs プロジェクト: Steviegt6/SpiritMod
        public override void AI()
        {
            Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f);
            Player player = Main.player[projectile.owner];

            if (projectile.Distance(player.Center) > 1500)
            {
                projectile.position = player.position + new Vector2(Main.rand.Next(-125, 126), Main.rand.Next(-125, 126));
            }
            MyPlayer modPlayer = player.GetSpiritPlayer();

            if (player.dead)
            {
                modPlayer.caltfist = false;
            }

            if (modPlayer.caltfist)
            {
                projectile.timeLeft = 2;
            }

            projectile.localAI[0] += 1f;
            if (projectile.localAI[0] >= 10f)
            {
                projectile.localAI[0] = 0f;
                int num171 = 30;
                if ((projectile.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num171 * 16))
                {
                    int num172 = (int)projectile.Center.X / 16;
                    int num173 = (int)projectile.Center.Y / 16;
                    int num3;
                    for (int num174 = num172 - num171; num174 <= num172 + num171; num174 = num3 + 1)
                    {
                        for (int num175 = num173 - num171; num175 <= num173 + num171; num175 = num3 + 1)
                        {
                            if (Main.rand.Next(4) == 0)
                            {
                                Vector2 vector16 = new Vector2((float)(num172 - num174), (float)(num173 - num175));
                                if (vector16.Length() < (float)num171 && num174 > 0 && num174 < Main.maxTilesX - 1 && num175 > 0 && num175 < Main.maxTilesY - 1 && Main.tile[num174, num175] != null && Main.tile[num174, num175].active())
                                {
                                    bool flag3 = false;
                                    if (Main.tile[num174, num175].type == 185 && Main.tile[num174, num175].frameY == 18)
                                    {
                                        if (Main.tile[num174, num175].frameX >= 576 && Main.tile[num174, num175].frameX <= 882)
                                        {
                                            flag3 = true;
                                        }
                                    }
                                    else if (Main.tile[num174, num175].type == 186 && Main.tile[num174, num175].frameX >= 864 && Main.tile[num174, num175].frameX <= 1170)
                                    {
                                        flag3 = true;
                                    }
                                    if (flag3 || Main.tileSpelunker[(int)Main.tile[num174, num175].type] || (Main.tileAlch[(int)Main.tile[num174, num175].type] && Main.tile[num174, num175].type != 82))
                                    {
                                        int num176 = Dust.NewDust(new Vector2((float)(num174 * 16), (float)(num175 * 16)), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f);
                                        Main.dust[num176].fadeIn = 0.75f;
                                        Dust dust3 = Main.dust[num176];
                                        dust3.velocity           *= 0.1f;
                                        Main.dust[num176].noLight = true;
                                    }
                                }
                            }
                            num3 = num175;
                        }
                        num3 = num174;
                    }
                }
            }
        }
コード例 #40
0
        public override void onPlayerJoin(PlayerLoginEvent Event)
        {
            int nPlayerIndex = Event.getPlayer().whoAmi;

            MyPlayer oPlayer = new MyPlayer(nPlayerIndex);

            Players[nPlayerIndex] = oPlayer;

            Event.setCancelled(false);
        }
コード例 #41
0
ファイル: player.cs プロジェクト: rafaelbaiolim/Unity
 //Tudo que ocorre quando o personagem e criado
 void Start()
 {
     oPlayer = new MyPlayer();
     estaNoChao = true;
     animator = spritePlayer.GetComponent<Animator>();
 }
コード例 #42
0
 void Start() { myPlayer = ObjectManager.instance.myPlayer; isWaitCD = false; }
コード例 #43
0
	void Awake()
	{
		mytransform = transform;
		myanimation = GetComponent<Animation>();
		myaudio = GetComponent<AudioSource>();
		script_monEf = GameObject.FindWithTag("efs_mon").GetComponent<Monster_efs>();
		enemy = GameObject.FindWithTag("Respawn").GetComponent<DB_Monster>().enemy[enemykind];
		//Debug.Log(enemykind);
		cha1 = GameObject.FindWithTag("Player").transform;
		script_cha = cha1.GetComponent<MyPlayer>();
		script_sound = GameObject.FindWithTag("sound").GetComponent<SoundEf_slash>();
		script_cam = Camera.main.GetComponent<CamMove>();
	}
コード例 #44
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && shootCount <= 0 && projectile.owner == Main.myPlayer)
                {
                    projectile.frame       = 0;
                    secondaryAbilityFrames = true;
                }
                if (secondaryAbilityFrames)
                {
                    Main.mouseLeft = false;
                    if (projectile.frame >= 4)
                    {
                        shootCount += 120;
                        Vector2 shootVel = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= 8f;
                        int proj = Projectile.NewProjectile(projectile.Center, shootVel, mod.ProjectileType("MeltYourHeart"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, projectile.owner);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                        secondaryAbilityFrames          = false;
                    }
                }
                if (!attackFrames)
                {
                    if (!secondaryAbilityFrames)
                    {
                        StayBehind();
                    }
                    else
                    {
                        GoInFront();
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
コード例 #45
0
 public bool UpdateLose(MyPlayer player, MyEntity me)
 {
     if (Won || Lost)
         return true;
     for (int i = 0; i < m_loseTriggers.Count; i++)
     {
         var trigger = m_loseTriggers[i];
         if (trigger.IsTrue || trigger.Update(player, me))
         { //Loser!
             MySyncMissionTriggers.PlayerLost(player.Id, i);
             return true;
         }
     }
     return false;
 }
コード例 #46
0
        /// <summary>
        /// Replies the message.
        /// </summary>
        /// <param name="Player">The player.</param>
        /// <param name="Message">The message.</param>
        public static void ReplyMessage(MyPlayer Player, string Message)
        {
            if (Player == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(Message))
            {
                try
                {
                    oPrivateMsgManager.SendReply(Player, Message);
                }
                catch (Exception er)
                {
                    Player.SendMessage(string.Format("Reply Error: {0}", er.Message));
                    Console.WriteLine(string.Format("Reply Error: {0}", er.Message));
                }
            }
            else
            {
                Player.SendMessage("Command Error: /reply <message>");
            }
        }
コード例 #47
0
        public bool RaiseSignal(MyPlayer.PlayerId Id, Signal signal)
        {
            if (Won || Lost)
                return true;
            switch (signal)
            {
                case Signal.OTHER_WON:
                case Signal.PLAYER_DIED:
                case Signal.ALL_OTHERS_LOST:
                    for (int i = 0; i < m_winTriggers.Count; i++)
                    {
                        var trigger = m_winTriggers[i];
                        if (trigger.IsTrue || trigger.RaiseSignal(signal))
                        { //Won!
                            SetPlayerWon(Id, i);
                            return true;
                        }
                    }

                    for (int i = 0; i < m_loseTriggers.Count; i++)
                    {
                        var trigger = m_loseTriggers[i];
                        if (trigger.IsTrue || trigger.RaiseSignal(signal))
                        {//Lost
                            SetPlayerLost(Id, i);
                            return true;
                        }
                    }
                    break;

                default:
                    Debug.Fail("Wrong signal received");
                    break;
            }
            return false;
        }
コード例 #48
0
        static void SetPlayerLost(MyPlayer.PlayerId id, int triggerIndex)
        {
            MySessionComponentMissionTriggers.Static.SetLost(id, triggerIndex);
            if (!Sync.MultiplayerActive || !MySession.Static.IsScenario)
                return;

            MyMultiplayer.RaiseStaticEvent(s => MyMissionTriggers.OnPlayerLost, id, triggerIndex);
        }
コード例 #49
0
ファイル: AdamantiteVisor.cs プロジェクト: JaymenL/DBZMOD
 public override void UpdateArmorSet(Player player)
 {
     player.setBonus = "7% Increased Ki Damage";
     MyPlayer.ModPlayer(player).KiDamage += 0.7f;
 }
コード例 #50
0
 public override void UpdateArmorSet(Player player)
 {
     player.setBonus = "Pressing `Armor Bonus` grants you Demonic Overdrive, granting infinite ki for a limited time.";
     MyPlayer.ModPlayer(player).DemonBonus = true;
 }
コード例 #51
0
ファイル: AdamantiteVisor.cs プロジェクト: JaymenL/DBZMOD
 public override void UpdateEquip(Player player)
 {
     MyPlayer.ModPlayer(player).KiDamage += 0.12f;
     MyPlayer.ModPlayer(player).KiCrit   += 10;
     MyPlayer.ModPlayer(player).KiMax    += 250;
 }
コード例 #52
0
ファイル: Neovirtuo.cs プロジェクト: ISalliga/ElementsAwoken
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(mod);

            modPlayer.neovirtuoBonus = true;
            //asterox effects
            player.noKnockback       = true;
            player.statDefense      += 12;
            player.armorPenetration += 5;
            player.lifeRegen        += 3;
            player.moveSpeed        *= 1.2f;
            player.panic             = true;
            if (!hideVisual)
            {
                if (player.ownedProjectileCounts[mod.ProjectileType("NeovirtuoShieldBase")] < 1)
                {
                    Projectile.NewProjectile(player.position.X, player.position.Y, 0f, 0f, mod.ProjectileType("NeovirtuoShieldBase"), 50, 10f, player.whoAmI, 0.0f, 0.0f);
                }
            }

            //unity effects
            player.statDefense += 5;
            if (player.statLife <= (player.statLifeMax2 * 0.9f) && player.statLife >= (player.statLifeMax2 * 0.9f))
            {
                player.endurance += 0.04f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.8f) && player.statLife >= (player.statLifeMax2 * 0.7f))
            {
                player.endurance += 0.08f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.7f) && player.statLife >= (player.statLifeMax2 * 0.6f))
            {
                player.endurance += 0.16f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.6f) && player.statLife >= (player.statLifeMax2 * 0.5f))
            {
                player.endurance += 0.20f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.5f) && player.statLife >= (player.statLifeMax2 * 0.4f))
            {
                player.endurance += 0.24f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.4f) && player.statLife >= (player.statLifeMax2 * 0.3f))
            {
                player.endurance += 0.28f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.3f) && player.statLife >= (player.statLifeMax2 * 0.2f))
            {
                player.endurance += 0.32f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.2f) && player.statLife >= (player.statLifeMax2 * 0.1f))
            {
                player.endurance += 0.36f;
            }
            if (player.statLife <= (player.statLifeMax2 * 0.1f))
            {
                player.endurance += 0.40f;
            }

            player.statManaMax2  += 100;
            player.magicDamage   *= 1.15f;
            player.moveSpeed     *= 1.16f;
            player.noKnockback    = true;
            player.fireWalk       = true;
            player.buffImmune[46] = true;
            player.buffImmune[44] = true;
            player.buffImmune[33] = true;
            player.buffImmune[36] = true;
            player.buffImmune[30] = true;
            player.buffImmune[20] = true;
            player.buffImmune[32] = true;
            player.buffImmune[31] = true;
            player.buffImmune[35] = true;
            player.buffImmune[23] = true;
            player.buffImmune[22] = true;
        }
コード例 #53
0
 public override void DisplayHints(MyPlayer player, MyEntity me)
 {
     if (MySession.Static.IsScenario)
         MyHud.ScenarioInfo.LivesLeft = LivesLeft;
 }
コード例 #54
0
        /// <summary>
        /// Privates the message enable disable.
        /// </summary>
        /// <param name="Player">The player.</param>
        /// <param name="Flag">The flag.</param>
        public static void PrivateMessageEnableDisable(MyPlayer Player, string Flag)
        {
            if (Player == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(Flag))
            {
                if (Flag.Equals("on"))
                {
                    oPrivateMsgManager.PrivateMessageEnableDisable(Player, true);
                }
                else if (Flag.Equals("off"))
                {
                    oPrivateMsgManager.PrivateMessageEnableDisable(Player, false);
                }
            }
            else
            {
                Player.SendMessage("Command Error: /privmsg <on|off>");
            }
        }
コード例 #55
0
 public void DisplayHints(MyPlayer player, MyEntity me)
 {
     for (int i = 0; i < m_winTriggers.Count; i++)
         m_winTriggers[i].DisplayHints(player, me);
     for (int i = 0; i < m_loseTriggers.Count; i++)
         m_loseTriggers[i].DisplayHints(player, me);
 }
コード例 #56
0
 public void Cleanup()
 {
     m_player.Controller.ControlledEntityChanged -= Controller_ControlledEntityChanged;
     m_player = null;
 }
コード例 #57
0
 static void OnPlayerLost(MyPlayer.PlayerId id, int triggerIndex)
 {
     MySessionComponentMissionTriggers.Static.SetLost(id, triggerIndex);
 }
コード例 #58
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (projectile.spriteDirection == 1)
            {
                drawOffsetX = -10;
            }
            if (projectile.spriteDirection == -1)
            {
                drawOffsetX = -60;
            }
            drawOriginOffsetY = -halfStandHeight;
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")))
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timestopStartDelay = 120;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld");
                    zawarudo.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(zawarudo, projectile.position);
                    timestopStartDelay = 1;
                }
            }
            if (timestopStartDelay != 0)
            {
                timestopStartDelay++;
                if (timestopStartDelay >= 120)
                {
                    Timestop(2);
                    timestopPoseTimer  = 60;
                    timestopStartDelay = 0;
                }
            }
            if (timestopPoseTimer > 0)
            {
                timestopPoseTimer--;
                normalFrames    = false;
                attackFrames    = false;
                abilityPose     = true;
                Main.mouseLeft  = false;
                Main.mouseRight = false;
                if (timestopPoseTimer <= 1)
                {
                    abilityPose = false;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
コード例 #59
0
 public override float GetHealthDrainRate(MyPlayer player) => ModifiedHealthDrainRate + (4 * player.kaiokenLevel - 1);
コード例 #60
0
ファイル: MyTrigger.cs プロジェクト: fluxit/SpaceEngineers
 public virtual bool Update(MyPlayer player, MyEntity me)
 {
     return IsTrue;
 }