-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorldMod.cs
More file actions
119 lines (109 loc) · 4.29 KB
/
Copy pathWorldMod.cs
File metadata and controls
119 lines (109 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria;
using Terraria.ModLoader;
namespace NExperience
{
public class WorldMod : ModWorld
{
public static bool IsDeathMode = false;
public static bool InGraveyardRegion = false;
public static string WorldGameMode = "";
public static int WorldRebirthLevel = 0, LastRebirthLevelCalc = 0;
private static float EnemyHealth = 1f, EnemyDamage = 1f, EnemyDefense = 1f, EnemyKnockbackRes = 1f, EnemyCoins = 1f;
public static float EnemyHealthBonus { get { return EnemyHealth * 0.1f; } }
public static float EnemyDamageBonus { get { return EnemyDamage * 0.1f; } }
public static float EnemyDefenseBonus { get { return EnemyDefense * 0.1f; } }
public static void ResetLevelCalc()
{
LastRebirthLevelCalc = 0;
EnemyHealth = 1f;
EnemyDamage = 1f;
EnemyDefense = 1f;
EnemyKnockbackRes = 1f;
EnemyCoins = 1f;
}
public static void RebirthWorld()
{
WorldRebirthLevel++;
NPC.downedAncientCultist = NPC.downedBoss1 = NPC.downedBoss2 = NPC.downedBoss3 = NPC.downedChristmasIceQueen = NPC.downedChristmasSantank = NPC.downedChristmasTree =
NPC.downedClown = NPC.downedFishron = NPC.downedFrost = NPC.downedGoblins = NPC.downedGolemBoss = NPC.downedHalloweenKing = NPC.downedHalloweenTree =
NPC.downedMartians = NPC.downedMechBoss1 = NPC.downedMechBoss2 = NPC.downedMechBoss3 = NPC.downedMechBossAny = NPC.downedMoonlord = NPC.downedPirates =
NPC.downedPlantBoss = NPC.downedQueenBee = NPC.downedSlimeKing = NPC.downedTowerNebula = NPC.downedTowerSolar = NPC.downedTowerStardust = NPC.downedTowerVortex =
Main.hardMode = false;
Main.NewText("The World has been Rebirth.");
}
public static void UpdateWorldMobRebirthStatus()
{
if (LastRebirthLevelCalc < WorldRebirthLevel)
{
LastRebirthLevelCalc++;
EnemyHealth *= 1.225f;
EnemyDamage *= 1.225f;
EnemyDefense *= 1.225f;
EnemyKnockbackRes += 0.05f;
EnemyCoins += 0.1f;
}
}
public override void Initialize()
{
if (WorldGameMode == "" || MainMod.GetGameMode(WorldGameMode) == null)
{
WorldGameMode = MainMod.GetGameModeIDs[0];
}
NpcMod.CanSpawnKrampus = false;
TileMod.PlayerPlacedTiles.Clear();
MainMod.WarnGameModeChange = true;
//IsDeathMode = false;
ResetLevelCalc();
}
public override void PreUpdate()
{
if(Main.netMode != 1)
{
if (NpcMod.CanSpawnKrampus)
{
if (Main.dayTime)
{
NpcMod.CanSpawnKrampus = false;
MainMod.SendChatMessage("You feel at ease as day rises.", Microsoft.Xna.Framework.Color.Green);
}
}
else
{
if (Main.xMas && !Main.dayTime && Main.time == 0 && (Main.hardMode || NPC.downedQueenBee) && Main.rand.Next(5) == 0)
{
NpcMod.CanSpawnKrampus = true;
MainMod.SendChatMessage("You have a horrible feeling about this night...", Microsoft.Xna.Framework.Color.Red);
}
}
}
UpdateWorldMobRebirthStatus();
}
public override void TileCountsAvailable(int[] tileCounts)
{
InGraveyardRegion = tileCounts[Terraria.ID.TileID.Tombstones] >= 12;
}
public override Terraria.ModLoader.IO.TagCompound Save()
{
Terraria.ModLoader.IO.TagCompound tag = new Terraria.ModLoader.IO.TagCompound();
tag.Add("WorldVersion", MainMod.ModVersion);
tag.Add("GameModeID", WorldGameMode);
tag.Add("DeathMode", IsDeathMode);
return tag;
}
public override void Load(Terraria.ModLoader.IO.TagCompound tag)
{
if (!tag.ContainsKey("WorldVersion"))
{
return;
}
int Version = tag.GetInt("WorldVersion");
WorldGameMode = tag.GetString("GameModeID");
if(Version > 1)
IsDeathMode = tag.GetBool("DeathMode");
}
}
}