-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMasomodeEXWorld.cs
88 lines (77 loc) · 2.52 KB
/
MasomodeEXWorld.cs
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
using System.Collections.Generic;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace MasomodeEX
{
internal partial class MasomodeEXWorld : ModWorld
{
public static int MutantSummons;
public static int MutantDefeats;
public static int MutantPlayerKills;
public override void Initialize()
{
MutantSummons = 0;
MutantDefeats = 0;
MutantPlayerKills = 0;
}
public override TagCompound Save()
{
List<int> mutant = new List<int>
{
MutantSummons,
MutantDefeats,
MutantPlayerKills
};
return new TagCompound
{
{"mutant", mutant}
};
}
public override void Load(TagCompound tag)
{
if (tag.ContainsKey("mutant"))
{
IList<int> count = tag.GetList<int>("mutant");
MutantSummons = count[0];
MutantDefeats = count[1];
MutantPlayerKills = count[2];
}
}
public override void NetReceive(BinaryReader reader)
{
MutantSummons = reader.ReadInt32();
MutantDefeats = reader.ReadInt32();
MutantPlayerKills = reader.ReadInt32();
}
public override void NetSend(BinaryWriter writer)
{
writer.Write(MutantSummons);
writer.Write(MutantDefeats);
writer.Write(MutantPlayerKills);
}
public override void PreUpdate()
{
Main.expertMode = true;
FargowiltasSouls.FargoSoulsWorld.MasochistMode = true;
if (Main.time == 1 && Main.netMode != 1)
{
if (Main.dayTime) //all bosses become DG at daybreak
for (int i = 0; i < Main.maxNPCs; i++)
if (Main.npc[i].active && (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead))
Main.npc[i].Transform(NPCID.DungeonGuardian);
if (Main.rand.Next(4) == 0) //bloodmoon, eclipse
{
if (!Main.dayTime)
Main.bloodMoon = true;
else if (Main.hardMode)
Main.eclipse = true;
if (Main.netMode == 2)
NetMessage.SendData(7); //sync world
}
}
}
}
}