-
Notifications
You must be signed in to change notification settings - Fork 1
/
LegendaryDogsGivesRep.cs
77 lines (71 loc) · 2.72 KB
/
LegendaryDogsGivesRep.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
using System;
using System.Collections.Generic;
using XRL.UI;
using XRL.World;
using XRL.Messages;
using XRL.Collections;
namespace XRL.World.Parts
{
public class LegendaryDogsGivesRep : GivesRep
{
public bool FixedRep;
public override void Register(GameObject Object)
{
FixedRep = false;
base.Register(Object);
}
public void ReplaceFactions()
{
GivesRep RepPart = this;
GameObject dog = ParentObject;
LegendaryDogsDogHero1 HeroPart = dog.GetPart<LegendaryDogsDogHero1>();
if (ParentObject.DisplayName.Contains("Good"))
{
RepPart.ResetRelatedFactions();
foreach (Faction Faction in Factions.loop())
{
if (Faction.Visible && !dog.pBrain.Allegiance.ContainsKey(Faction.Name))
{
FriendorFoe FoF = new FriendorFoe();
FoF.faction = Faction.Name;
FoF.status = "friend";
FoF.reason = "for being a " + HeroPart.Title + " dog";
RepPart.relatedFactions.Add(FoF);
if (dog.pBrain.FactionFeelings.ContainsKey(Faction.Name))
{
StringMap<int> factionFeelings = dog.pBrain.FactionFeelings;
factionFeelings[Faction.Name] += HeroPart.GoodFactionPenalty;
}
else
{
dog.pBrain.FactionFeelings.Add(Faction.Name, HeroPart.GoodFactionPenalty);
}
}
}
RepPart.repValue = HeroPart.GoodFactionPenalty;
} else {
MessageQueue.AddPlayerMessage("fire");
MessageQueue.AddPlayerMessage(RepPart.relatedFactions.Count.ToString());
foreach (FriendorFoe FoF in RepPart.relatedFactions)
{
if (FoF.status == "friend")
{
MessageQueue.AddPlayerMessage("like");
FoF.reason = LegendaryDogsGenerateFriendOrFoe.getLikeReason();
} else {
MessageQueue.AddPlayerMessage("dislike");
FoF.reason = LegendaryDogsGenerateFriendOrFoe.getHateReason();
}
}
}
}
public override bool HandleEvent(GetShortDescriptionEvent E)
{
if (!FixedRep) {
ReplaceFactions();
FixedRep = true;
}
return base.HandleEvent(E);
}
}
}