public override void SetDefaults(NPC npc) { FargoSoulsGlobalNPC fargoSoulsGlobalNPC = npc.GetGlobalNPC <FargoSoulsGlobalNPC>(); if (FargoSoulsWorld.MasochistMode) { if (Calamity != null) { if (npc.type == NPCType <StormlionCharger>()) { npc.lifeMax = 250; npc.buffImmune[BuffID.Electrified] = true; npc.buffImmune[BuffType <LightningRod>()] = true; } if (npc.type == NPCType <GhostBell>()) { npc.buffImmune[BuffID.Electrified] = true; if (Main.hardMode) { npc.buffImmune[BuffType <LightningRod>()] = true; } } } } }
public override void Update(Player player, ref int buffIndex) { player.GetModPlayer <FargoPlayer>().MutantPresence = true; //LUL player.GetModPlayer <FargoPlayer>().noDodge = true; player.GetModPlayer <FargoPlayer>().noSupersonic = true; player.moonLeech = true; if (FargoSoulsGlobalNPC.BossIsAlive(ref FargoSoulsGlobalNPC.fishBoss, NPCID.DukeFishron)) { player.buffTime[buffIndex] = 2; if (player.whoAmI == Main.npc[FargoSoulsGlobalNPC.fishBoss].target && player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("FishronRitual2")] < 1) { Projectile.NewProjectile(Main.npc[FargoSoulsGlobalNPC.fishBoss].Center, Vector2.Zero, mod.ProjectileType("FishronRitual2"), 0, 0f, player.whoAmI, 0f, FargoSoulsGlobalNPC.fishBoss); } } else { return; } /*float distance = player.Distance(Main.npc[FargoSoulsGlobalNPC.fishBoss].Center); * const float threshold = 1200f; * if (distance > threshold) * { * if (distance > threshold * 1.5f) * { * if (distance > threshold * 2f) * { * player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to escape."), 7777, 0); * return; * } * * player.frozen = true; * player.controlHook = false; * player.controlUseItem = false; * if (player.mount.Active) * player.mount.Dismount(player); * player.velocity.X = 0f; * player.velocity.Y = -0.4f; * } * * Vector2 movement = Main.npc[FargoSoulsGlobalNPC.fishBoss].Center - player.Center; * float difference = movement.Length() - 1200f; * movement.Normalize(); * movement *= difference < 17f ? difference : 17f; * player.position += movement; * * for (int i = 0; i < 20; i++) * { * int d = Dust.NewDust(player.position, player.width, player.height, 135, 0f, 0f, 0, default(Color), 2.5f); * Main.dust[d].noGravity = true; * Main.dust[d].noLight = true; * Main.dust[d].velocity *= 5f; * } * }*/ }
public override void Update(Player player, ref int buffIndex) { FargoPlayer fargoPlayer = player.GetModPlayer <FargoPlayer>(); player.poisoned = true; player.venom = true; player.ichor = true; player.onFire2 = true; player.electrified = true; //fargoPlayer.OceanicMaul = true; fargoPlayer.CurseoftheMoon = true; if (fargoPlayer.FirstInfection) { fargoPlayer.MaxInfestTime = player.buffTime[buffIndex]; fargoPlayer.FirstInfection = false; } fargoPlayer.Infested = true; fargoPlayer.Rotting = true; fargoPlayer.MutantNibble = true; fargoPlayer.noDodge = true; fargoPlayer.noSupersonic = true; fargoPlayer.MutantPresence = true; player.moonLeech = true; player.potionDelay = player.buffTime[buffIndex]; if (Fargowiltas.Instance.MasomodeEXLoaded && !FargoSoulsWorld.downedFishronEX && player.buffTime[buffIndex] > 1 && FargoSoulsGlobalNPC.BossIsAlive(ref FargoSoulsGlobalNPC.mutantBoss, mod.NPCType("MutantBoss"))) { player.AddBuff(ModLoader.GetMod("MasomodeEX").BuffType("MutantJudgement"), player.buffTime[buffIndex]); player.buffTime[buffIndex] = 1; } }
public override void NPCLoot() { FargoSoulsWorld.downedChampions[6] = true; if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); //sync world } FargoSoulsGlobalNPC.DropEnches(npc, ModContent.ItemType <Items.Accessories.Forces.SpiritForce>()); }
public static void NecroSpawnGraveBoss(FargoSoulsGlobalNPC globalNPC, NPC npc, Player player, int damage) { globalNPC.NecroDamage += damage; if (globalNPC.NecroDamage > npc.lifeMax / 10) { globalNPC.NecroDamage = 0; Projectile.NewProjectile(player.GetSource_Misc(""), npc.Center, new Vector2(0, -3), ModContent.ProjectileType <NecroGrave>(), 0, 0, player.whoAmI, npc.lifeMax / 25); } }
public override void OnHitPlayer(Player target, int damage, bool crit) { if (FargoSoulsGlobalNPC.BossIsAlive(ref FargoSoulsGlobalNPC.guardBoss, NPCID.DungeonGuardian)) { target.AddBuff(mod.BuffType("GodEater"), 420); target.AddBuff(mod.BuffType("FlamesoftheUniverse"), 420); target.AddBuff(mod.BuffType("MarkedforDeath"), 420); target.immune = false; target.immuneTime = 0; target.hurtCooldowns[1] = 0; } }
public override void NPCLoot() { FargoSoulsWorld.downedChampions[5] = true; if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); //sync world } for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].hostile && Main.projectile[i].type == ModContent.ProjectileType <ShadowClone>()) { Main.projectile[i].Kill(); } } FargoSoulsGlobalNPC.DropEnches(npc, ModContent.ItemType <Items.Accessories.Forces.ShadowForce>()); }
public override void Update(NPC npc, ref int buffIndex) { FargoSoulsGlobalNPC fargoNPC = npc.GetGlobalNPC<FargoSoulsGlobalNPC>(); npc.poisoned = true; npc.venom = true; npc.ichor = true; npc.onFire2 = true; npc.betsysCurse = true; npc.midas = true; fargoNPC.Electrified = true; fargoNPC.OceanicMaul = true; fargoNPC.CurseoftheMoon = true; fargoNPC.Infested = true; fargoNPC.Rotting = true; fargoNPC.MutantNibble = true; fargoNPC.Sadism = true; }
public override void OnHitPlayer(Player target, int damage, bool crit) { if (FargoSoulsGlobalNPC.BossIsAlive(ref FargoSoulsGlobalNPC.deviBoss, mod.NPCType("DeviBoss"))) { target.AddBuff(mod.BuffType("Berserked"), 240); target.AddBuff(mod.BuffType("MutantNibble"), 240); target.AddBuff(mod.BuffType("Guilty"), 240); target.AddBuff(mod.BuffType("Lovestruck"), 240); target.AddBuff(mod.BuffType("Rotting"), 240); } else { for (int i = 0; i < 5; i++) { int d = Main.rand.Next(Fargowiltas.DebuffIDs.Count); target.AddBuff(Fargowiltas.DebuffIDs[d], 240); } } }
public override bool CanHitPlayer(Player target) { if (projectile.Colliding(projectile.Hitbox, target.Hitbox)) { target.hurtCooldowns[0] = 0; int defense = target.statDefense; float endurance = target.endurance; target.statDefense = 0; target.endurance = 0; target.Hurt(PlayerDeathReason.ByCustomReason(target.name + " felt heartbroken."), projectile.damage, 0, false, false, false, 0); target.statDefense = defense; target.endurance = endurance; projectile.timeLeft = 0; if (FargoSoulsGlobalNPC.BossIsAlive(ref FargoSoulsGlobalNPC.deviBoss, mod.NPCType("DeviBoss"))) { target.AddBuff(mod.BuffType("Lovestruck"), 240); } } return(false); }
public override void Kill(int timeLeft) { for (int i = 0; i < 10; i++) { int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 86, 0f, 0f, 0, default(Color), 2f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 8f; } if (FargoSoulsGlobalNPC.BossIsAlive(ref FargoSoulsGlobalNPC.deviBoss, mod.NPCType("DeviBoss"))) { if (Main.netMode != 1) { for (int i = 0; i < 4; i++) { Projectile.NewProjectile(projectile.Center, Vector2.UnitX.RotatedBy(projectile.rotation + (float)Math.PI / 2 * i), mod.ProjectileType("DeviDeathray"), projectile.damage, projectile.knockBack, projectile.owner); } } } }
public override void PostAI(Projectile proj) { if (FargoSoulsWorld.MasochistMode) { if (ThoriumProj(proj)) { if (proj.damage != CachedDamage) { if ( proj.type == ProjectileType <GrandThunderBirdZap>() || proj.type == ProjectileType <ThunderGust>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.birdBoss, NPCType <TheGrandThunderBirdv2>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.ThunderBirdCount * .0125)); } } else if ( proj.type == ProjectileType <BubbleBomb>() || proj.type == ProjectileType <BubblePulse>() || proj.type == ProjectileType <QueenTorrent>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.jellyfishBoss, NPCType <QueenJelly>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.JellyCount * .0125)); } } else if ( proj.type == ProjectileType <ViscountBlood>() || proj.type == ProjectileType <ViscountStomp>() || proj.type == ProjectileType <ViscountStomp2>() || proj.type == ProjectileType <ViscountRipple>() || proj.type == ProjectileType <ViscountRipple2>() || proj.type == ProjectileType <ViscountRockFall>() || proj.type == ProjectileType <ViscountRockSummon>() || proj.type == ProjectileType <ViscountRockSummon2>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.viscountBoss, NPCType <Viscount>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.VisCount * .0125)); } } else if ( proj.type == ProjectileType <GraniteCharge>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.graniteBoss, NPCType <GraniteEnergyStorm>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.GraniteCount * .0125)); } } else if ( proj.type == ProjectileType <BuriedMagicPro2>() || proj.type == ProjectileType <BuriedShock>() || proj.type == ProjectileType <BuriedDagger>() || proj.type == ProjectileType <BuriedArrow>() || proj.type == ProjectileType <BuriedArrow2>() || proj.type == ProjectileType <BuriedArrowC>() || proj.type == ProjectileType <BuriedArrowP>() || proj.type == ProjectileType <BuriedArrowF>() || proj.type == ProjectileType <BuriedMagic>() || proj.type == ProjectileType <BuriedArrowFBoom>() || proj.type == ProjectileType <BuriedMagicPop>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.buriedBoss, NPCType <TheBuriedWarrior>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.ChampionCount * .0125)); } } else if ( proj.type == ProjectileType <BioCoreBeam>() || proj.type == ProjectileType <BioVaporize>() || proj.type == ProjectileType <CryoCoreBeam>() || proj.type == ProjectileType <CryoVaporize>() || proj.type == ProjectileType <MoltenCoreBeam>() || proj.type == ProjectileType <MoltenVaporize>() || proj.type == ProjectileType <MainBeam>() || proj.type == ProjectileType <MainBeamOuter>() || proj.type == ProjectileType <MainBeamCheese>() || proj.type == ProjectileType <VaporizeBlast>() || proj.type == ProjectileType <GravitonSurge>() || proj.type == ProjectileType <Vaporize>() || proj.type == ProjectileType <VaporizeBlast>() || proj.type == ProjectileType <GravitonCharge>() || proj.type == ProjectileType <VaporizePulse>() || proj.type == ProjectileType <VaporizeBoom>() || proj.type == ProjectileType <GravitonBoom>() || proj.type == ProjectileType <GravitySpark>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.scouterBoss, NPCType <ThePrimeScouter>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.ScouterCount * .0125)); } } else if ( proj.type == ProjectileType <FrostSurgeR>() || proj.type == ProjectileType <FrostSurge>() || proj.type == ProjectileType <BlizzardStart>() || proj.type == ProjectileType <BlizzardFang>() || proj.type == ProjectileType <IceAnomaly>() || proj.type == ProjectileType <FrostMytePro>() || proj.type == ProjectileType <BlizzardCascade>() || proj.type == ProjectileType <BlizzardBoom>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.striderBoss, NPCType <BoreanStrider>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.striderBoss, NPCType <BoreanStriderPopped>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.StriderCount * .0125)); } } else if ( proj.type == ProjectileType <BeholderBeam>() || proj.type == ProjectileType <DoomBeholderBeam>() || proj.type == ProjectileType <VoidLaserPro>() || proj.type == ProjectileType <BeholderLavaCascade>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.coznixBoss, NPCType <FallenDeathBeholder>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.coznixBoss, NPCType <FallenDeathBeholder2>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.BeholderCount * .0125)); } } else if ( proj.type == ProjectileType <LichGazeB>() || proj.type == ProjectileType <LichGaze>() || proj.type == ProjectileType <LichFlareSpawn>() || proj.type == ProjectileType <LichPulse>() || proj.type == ProjectileType <SoulRenderLich>() || proj.type == ProjectileType <SoulSiphon>() || proj.type == ProjectileType <LichFlareDeathD>() || proj.type == ProjectileType <LichFlareDeathU>() || proj.type == ProjectileType <LichFlare>() || proj.type == ProjectileType <LichSing>() || proj.type == ProjectileType <LichMatter>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.lichBoss, NPCType <Lich>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.lichBoss, NPCType <LichHeadless>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.LichCount * .0125)); } } else if ( proj.type == ProjectileType <Whirlpool>() || proj.type == ProjectileType <AbyssionSpit>() || proj.type == ProjectileType <AbyssionSpit2>() || proj.type == ProjectileType <AquaRipple>() || proj.type == ProjectileType <AbyssalStrike>() || proj.type == ProjectileType <AbyssalStrike2>() || proj.type == ProjectileType <OldGodSpit>() || proj.type == ProjectileType <OldGodSpit2>() ) { if (FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.abyssBoss, NPCType <Abyssion>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.abyssBoss, NPCType <AbyssionCracked>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.abyssBoss, NPCType <AbyssionReleased>())) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.AbyssionCount * .0125)); } } else if ( proj.type == ProjectileType <FlameLash>() || proj.type == ProjectileType <WaterPulse>() || proj.type == ProjectileType <TyphoonBlastHostile>() || proj.type == ProjectileType <TyphoonBlastHostileSmaller>() || proj.type == ProjectileType <AquaBarrage>() || proj.type == ProjectileType <AquaBlast>() || proj.type == ProjectileType <UFOBlast>() || proj.type == ProjectileType <OmniSphereOrb>() || proj.type == ProjectileType <DeathRaySpawn>() || proj.type == ProjectileType <RealityDreadPro>() || proj.type == ProjectileType <DeathRaySpawnR>() || proj.type == ProjectileType <DeathRaySpawnL>() || proj.type == ProjectileType <OmniDeath>() || proj.type == ProjectileType <RealityFury>() || proj.type == ProjectileType <FlamePulsePro>() || proj.type == ProjectileType <FlameNova>() || proj.type == ProjectileType <FlamePulseTorn>() || proj.type == ProjectileType <MoltenFury>() || proj.type == ProjectileType <DeathRay>() || proj.type == ProjectileType <OmniBurstHostile>() || proj.type == ProjectileType <GravitonBoom>() || proj.type == ProjectileType <FlameNovaBoom>() || proj.type == ProjectileType <SlagTornado>() || proj.type == ProjectileType <TornSlag>() ) { if ( FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.aquaBoss, NPCType <Aquaius>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.aquaBoss, NPCType <AquaiusBubblePrime>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.aquaBoss, NPCType <Aquaius2>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.omniBoss, NPCType <Omnicide>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.slagBoss, NPCType <SlagFury>()) || FargoSoulsGlobalNPC.BossIsAlive(ref MasoThoriumGlobalNPC.ragBoss, NPCType <RealityBreaker>()) ) { proj.damage = (int)(proj.damage * (1 + MasoDLCWorld.RagnarokCount * .0125)); } } CachedDamage = proj.damage; } } } }
public override void HandlePacket(BinaryReader reader, int whoAmI) { switch (reader.ReadByte()) { case 0: //server side spawning creepers if (Main.netMode == 2) { byte p = reader.ReadByte(); int multiplier = reader.ReadByte(); int n = NPC.NewNPC((int)Main.player[p].Center.X, (int)Main.player[p].Center.Y, NPCType("CreeperGutted"), 0, p, 0f, multiplier, 0f); if (n != 200) { Main.npc[n].velocity = Vector2.UnitX.RotatedByRandom(2 * Math.PI) * 8; NetMessage.SendData(23, -1, -1, null, n); } } break; case 1: //server side synchronize pillar data request if (Main.netMode == 2) { byte pillar = reader.ReadByte(); if (!Main.npc[pillar].GetGlobalNPC <FargoSoulsGlobalNPC>().masoBool[1]) { Main.npc[pillar].GetGlobalNPC <FargoSoulsGlobalNPC>().masoBool[1] = true; Main.npc[pillar].GetGlobalNPC <FargoSoulsGlobalNPC>().SetDefaults(Main.npc[pillar]); Main.npc[pillar].life = Main.npc[pillar].lifeMax; } } break; case 2: //net updating maso FargoSoulsGlobalNPC fargoNPC = Main.npc[reader.ReadByte()].GetGlobalNPC <FargoSoulsGlobalNPC>(); fargoNPC.masoBool[0] = reader.ReadBoolean(); fargoNPC.masoBool[1] = reader.ReadBoolean(); fargoNPC.masoBool[2] = reader.ReadBoolean(); fargoNPC.masoBool[3] = reader.ReadBoolean(); break; case 3: //rainbow slime/paladin, MP clients syncing to server if (Main.netMode == 1) { byte npc = reader.ReadByte(); Main.npc[npc].lifeMax = reader.ReadInt32(); float newScale = reader.ReadSingle(); Main.npc[npc].position = Main.npc[npc].Center; Main.npc[npc].width = (int)(Main.npc[npc].width / Main.npc[npc].scale * newScale); Main.npc[npc].height = (int)(Main.npc[npc].height / Main.npc[npc].scale * newScale); Main.npc[npc].scale = newScale; Main.npc[npc].Center = Main.npc[npc].position; } break; case 4: //moon lord vulnerability synchronization if (Main.netMode == 1) { int ML = reader.ReadByte(); Main.npc[ML].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter = reader.ReadInt32(); FargoSoulsGlobalNPC.masoStateML = reader.ReadByte(); } break; case 5: //retinazer laser MP sync if (Main.netMode == 1) { int reti = reader.ReadByte(); Main.npc[reti].GetGlobalNPC <FargoSoulsGlobalNPC>().masoBool[2] = reader.ReadBoolean(); Main.npc[reti].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter = reader.ReadInt32(); } break; case 6: //shark MP sync if (Main.netMode == 1) { int shark = reader.ReadByte(); Main.npc[shark].GetGlobalNPC <FargoSoulsGlobalNPC>().SharkCount = reader.ReadByte(); } break; case 7: //client to server activate dark caster family if (Main.netMode == 2) { int caster = reader.ReadByte(); if (Main.npc[caster].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter2 == 0) { Main.npc[caster].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter2 = reader.ReadInt32(); } } break; case 8: //server to clients reset counter if (Main.netMode == 1) { int caster = reader.ReadByte(); Main.npc[caster].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter2 = 0; } break; case 9: //client to server, request heart spawn if (Main.netMode == 2) { int n = reader.ReadByte(); Item.NewItem(Main.npc[n].Hitbox, ItemID.Heart); } break; case 10: //client to server, sync cultist data if (Main.netMode == 2) { int cult = reader.ReadByte(); FargoSoulsGlobalNPC cultNPC = Main.npc[cult].GetGlobalNPC <FargoSoulsGlobalNPC>(); cultNPC.Counter += reader.ReadInt32(); cultNPC.Counter2 += reader.ReadInt32(); cultNPC.Timer += reader.ReadInt32(); Main.npc[cult].localAI[3] += reader.ReadSingle(); } break; case 11: //refresh creeper if (Main.netMode != 0) { byte player = reader.ReadByte(); NPC creeper = Main.npc[reader.ReadByte()]; if (creeper.active && creeper.type == NPCType("CreeperGutted") && creeper.ai[0] == player) { int damage = creeper.lifeMax - creeper.life; creeper.life = creeper.lifeMax; if (damage > 0) { CombatText.NewText(creeper.Hitbox, CombatText.HealLife, damage); } if (Main.netMode == 2) { creeper.netUpdate = true; } } } break; case 77: //server side spawning fishron EX if (Main.netMode == 2) { byte target = reader.ReadByte(); int x = reader.ReadInt32(); int y = reader.ReadInt32(); FargoSoulsGlobalNPC.spawnFishronEX = true; NPC.NewNPC(x, y, NPCID.DukeFishron, 0, 0f, 0f, 0f, 0f, target); FargoSoulsGlobalNPC.spawnFishronEX = false; NetMessage.BroadcastChatMessage(NetworkText.FromLiteral("Duke Fishron EX has awoken!"), new Color(50, 100, 255)); } break; case 78: //confirming fish EX max life int f = reader.ReadInt32(); Main.npc[f].lifeMax = reader.ReadInt32(); break; default: break; } //BaseMod Stuff MsgType msg = (MsgType)reader.ReadByte(); if (msg == MsgType.ProjectileHostility) //projectile hostility and ownership { int owner = reader.ReadInt32(); int projID = reader.ReadInt32(); bool friendly = reader.ReadBoolean(); bool hostile = reader.ReadBoolean(); if (Main.projectile[projID] != null) { Main.projectile[projID].owner = owner; Main.projectile[projID].friendly = friendly; Main.projectile[projID].hostile = hostile; } if (Main.netMode == 2) { MNet.SendBaseNetMessage(0, owner, projID, friendly, hostile); } } else if (msg == MsgType.SyncAI) //sync AI array { int classID = reader.ReadByte(); int id = reader.ReadInt16(); int aitype = reader.ReadByte(); int arrayLength = reader.ReadByte(); float[] newAI = new float[arrayLength]; for (int m = 0; m < arrayLength; m++) { newAI[m] = reader.ReadSingle(); } if (classID == 0 && Main.npc[id] != null && Main.npc[id].active && Main.npc[id].modNPC != null && Main.npc[id].modNPC is ParentNPC) { ((ParentNPC)Main.npc[id].modNPC).SetAI(newAI, aitype); } else if (classID == 1 && Main.projectile[id] != null && Main.projectile[id].active && Main.projectile[id].modProjectile != null && Main.projectile[id].modProjectile is ParentProjectile) { ((ParentProjectile)Main.projectile[id].modProjectile).SetAI(newAI, aitype); } if (Main.netMode == 2) { BaseNet.SyncAI(classID, id, newAI, aitype); } } }
public override void AI() { if (FargoSoulsGlobalNPC.BossIsAlive(ref FargoSoulsGlobalNPC.cultBoss, NPCID.CultistBoss)) { projectile.alpha -= 2; if (projectile.alpha < 0) { projectile.alpha = 0; } Player player = Main.player[Main.myPlayer]; if (player.active && !player.dead) { float distance = player.Distance(projectile.Center); if (Math.Abs(distance - threshold) < 46f && player.hurtCooldowns[0] == 0 && projectile.alpha == 0) { int hitDirection = projectile.Center.X > player.Center.X ? 1 : -1; player.Hurt(PlayerDeathReason.ByProjectile(player.whoAmI, projectile.whoAmI), Main.npc[FargoSoulsGlobalNPC.cultBoss].damage, hitDirection, false, false, false, 0); player.AddBuff(mod.BuffType("CurseoftheMoon"), Main.rand.Next(300, 600)); } if (distance > threshold && distance < threshold * 4f) { if (distance > threshold * 2f) { player.frozen = true; player.controlHook = false; player.controlUseItem = false; if (player.mount.Active) { player.mount.Dismount(player); } player.velocity.X = 0f; player.velocity.Y = -0.4f; } Vector2 movement = projectile.Center - player.Center; float difference = movement.Length() - threshold; movement.Normalize(); movement *= difference < 17f ? difference : 17f; player.position += movement; for (int i = 0; i < 20; i++) { int d = Dust.NewDust(player.position, player.width, player.height, 135, 0f, 0f, 0, default(Color), 2.5f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].velocity *= 5f; } } } } else { projectile.velocity = Vector2.Zero; projectile.alpha += 2; if (projectile.alpha > 255) { projectile.Kill(); return; } } projectile.timeLeft = 2; projectile.scale = (1f - projectile.alpha / 255f) * 2f; projectile.ai[0] -= rotationPerTick; if (projectile.ai[0] > PI) { projectile.ai[0] -= 2f * PI; projectile.netUpdate = true; } projectile.frameCounter++; if (projectile.frameCounter >= 6) { projectile.frameCounter = 0; projectile.frame++; if (projectile.frame > 1) { projectile.frame = 0; } } }