Skip to content

Commit c7806db

Browse files
authored
Merge pull request #187 from Tiagobuzzz/codex/expandir-funcionalidades-do-sistema-de-conhecimento
2 parents 0538776 + 1b7e26a commit c7806db

File tree

6 files changed

+296
-0
lines changed

6 files changed

+296
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace UltraWorldAI.Knowledge;
5+
6+
public class SecretNetwork
7+
{
8+
public string Name = string.Empty;
9+
public List<string> Members = new();
10+
public List<string> HiddenTopics = new();
11+
public string AccessMethod = string.Empty; // "Código", "Ritual", "Alinhamento ideológico"
12+
public List<string> PoliticalAlliances = new();
13+
public List<string> MagicalPacts = new();
14+
public List<string> SupportedRebellions = new();
15+
}
16+
17+
public static class ForbiddenKnowledgeNetwork
18+
{
19+
public static List<SecretNetwork> Networks { get; } = new();
20+
21+
public static void CreateNetwork(string name, List<string> members, List<string> topics, string method)
22+
{
23+
Networks.Add(new SecretNetwork
24+
{
25+
Name = name,
26+
Members = members,
27+
HiddenTopics = topics,
28+
AccessMethod = method
29+
});
30+
31+
Console.WriteLine($"\ud83d\udd75\ufe0f Rede secreta criada: {name} | Método de acesso: {method} | Saberes ocultos: {topics.Count}");
32+
}
33+
34+
public static void InfluencePolitics(string name, string faction)
35+
{
36+
var net = Networks.Find(n => n.Name == name);
37+
if (net == null) return;
38+
if (!net.PoliticalAlliances.Contains(faction))
39+
net.PoliticalAlliances.Add(faction);
40+
41+
Console.WriteLine($"\ud83c\udfdb\ufe0f Rede {name} influenciou a política de {faction}");
42+
}
43+
44+
public static void ForgeMagicalPact(string name, string pact)
45+
{
46+
var net = Networks.Find(n => n.Name == name);
47+
if (net == null) return;
48+
if (!net.MagicalPacts.Contains(pact))
49+
net.MagicalPacts.Add(pact);
50+
51+
Console.WriteLine($"\u2728 Rede {name} selou pacto mágico: {pact}");
52+
}
53+
54+
public static void SupportRebellion(string name, string rebellion)
55+
{
56+
var net = Networks.Find(n => n.Name == name);
57+
if (net == null) return;
58+
if (!net.SupportedRebellions.Contains(rebellion))
59+
net.SupportedRebellions.Add(rebellion);
60+
61+
Console.WriteLine($"\u2694\ufe0f Rede {name} apoiou rebelião: {rebellion}");
62+
}
63+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace UltraWorldAI.Knowledge;
5+
6+
public class KnowledgeLineage
7+
{
8+
public string Founder = string.Empty;
9+
public string SchoolName = string.Empty;
10+
public List<string> Descendants = new();
11+
public bool IsHeretical;
12+
public string CoreBelief = string.Empty;
13+
public int Hunts;
14+
public int Wars;
15+
public int Purifications;
16+
}
17+
18+
public static class KnowledgeLineageSystem
19+
{
20+
public static List<KnowledgeLineage> Schools { get; } = new();
21+
22+
public static void RegisterLineage(
23+
string founder,
24+
string name,
25+
List<string> descendants,
26+
bool heresy,
27+
string belief)
28+
{
29+
Schools.Add(new KnowledgeLineage
30+
{
31+
Founder = founder,
32+
SchoolName = name,
33+
Descendants = descendants,
34+
IsHeretical = heresy,
35+
CoreBelief = belief
36+
});
37+
38+
Console.WriteLine($"\ud83c\udfdb\ufe0f Escola '{name}' fundada por {founder} | Herética? {heresy} | Doutrina: {belief}");
39+
}
40+
41+
public static void AddRepressionEvent(string school, string type)
42+
{
43+
var s = Schools.Find(sc => sc.SchoolName == school);
44+
if (s == null) return;
45+
46+
switch (type)
47+
{
48+
case "caça":
49+
s.Hunts++;
50+
break;
51+
case "guerra":
52+
s.Wars++;
53+
break;
54+
case "purificação":
55+
s.Purifications++;
56+
break;
57+
}
58+
59+
Console.WriteLine($"\u2694\ufe0f Evento '{type}' registrado contra a escola {school}");
60+
}
61+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace UltraWorldAI.Literature;
5+
6+
public class Book
7+
{
8+
public string Title = string.Empty;
9+
public string Author = string.Empty;
10+
public string Type = string.Empty; // "Livro científico", "Grimório", "Manuscrito filosófico"
11+
public List<string> Topics = new();
12+
public bool IsCursed;
13+
public string OriginPlace = string.Empty;
14+
public bool SelfWriting;
15+
public bool BurnsOnRead;
16+
}
17+
18+
public static class BookCreationSystem
19+
{
20+
public static List<Book> Library { get; } = new();
21+
22+
public static void WriteBook(
23+
string title,
24+
string author,
25+
string type,
26+
List<string> topics,
27+
bool cursed,
28+
string origin,
29+
bool selfWriting = false,
30+
bool burnsOnRead = false)
31+
{
32+
Library.Add(new Book
33+
{
34+
Title = title,
35+
Author = author,
36+
Type = type,
37+
Topics = topics,
38+
IsCursed = cursed,
39+
OriginPlace = origin,
40+
SelfWriting = selfWriting,
41+
BurnsOnRead = burnsOnRead
42+
});
43+
44+
Console.WriteLine($"\ud83d\udcd6 Livro criado: '{title}' por {author} | Tipo: {type} | Amaldiçoado? {cursed}");
45+
}
46+
47+
public static void ReadBook(string title)
48+
{
49+
var book = Library.Find(b => b.Title == title);
50+
if (book == null) return;
51+
52+
if (book.SelfWriting)
53+
Console.WriteLine($"\ud83d\udcdd O livro '{title}' continua se escrevendo sozinho...");
54+
55+
if (book.BurnsOnRead)
56+
{
57+
Console.WriteLine($"\ud83d\udd25 O livro '{title}' queimou ao ser lido!");
58+
Library.Remove(book);
59+
return;
60+
}
61+
62+
if (book.IsCursed)
63+
Console.WriteLine($"\u2620\ufe0f Você foi amaldiçoado ao ler '{title}'!");
64+
}
65+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Collections.Generic;
2+
using UltraWorldAI.Literature;
3+
using Xunit;
4+
5+
public class BookCreationSystemTests
6+
{
7+
[Fact]
8+
public void WriteBookAddsToLibrary()
9+
{
10+
BookCreationSystem.Library.Clear();
11+
BookCreationSystem.WriteBook(
12+
"Codice",
13+
"Thalor",
14+
"Grimório",
15+
new List<string> { "Magia" },
16+
true,
17+
"Templo",
18+
selfWriting: true,
19+
burnsOnRead: false);
20+
21+
Assert.Single(BookCreationSystem.Library);
22+
}
23+
24+
[Fact]
25+
public void ReadBookBurnsWhenFlagged()
26+
{
27+
BookCreationSystem.Library.Clear();
28+
BookCreationSystem.WriteBook(
29+
"Fênix",
30+
"Autor",
31+
"Tratado",
32+
new List<string>(),
33+
false,
34+
"Fornalha",
35+
burnsOnRead: true);
36+
37+
BookCreationSystem.ReadBook("Fênix");
38+
Assert.Empty(BookCreationSystem.Library);
39+
}
40+
}
41+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Collections.Generic;
2+
using UltraWorldAI.Knowledge;
3+
using Xunit;
4+
5+
public class ForbiddenKnowledgeNetworkTests
6+
{
7+
[Fact]
8+
public void CreateNetworkStoresNetwork()
9+
{
10+
ForbiddenKnowledgeNetwork.Networks.Clear();
11+
ForbiddenKnowledgeNetwork.CreateNetwork(
12+
"Veu",
13+
new List<string>(),
14+
new List<string>(),
15+
"Codigo");
16+
Assert.Single(ForbiddenKnowledgeNetwork.Networks);
17+
}
18+
19+
[Fact]
20+
public void InfluencePoliticsAddsAlliance()
21+
{
22+
ForbiddenKnowledgeNetwork.Networks.Clear();
23+
ForbiddenKnowledgeNetwork.CreateNetwork(
24+
"Veu",
25+
new List<string>(),
26+
new List<string>(),
27+
"Codigo");
28+
ForbiddenKnowledgeNetwork.InfluencePolitics("Veu", "Reino");
29+
Assert.Contains("Reino", ForbiddenKnowledgeNetwork.Networks[0].PoliticalAlliances);
30+
}
31+
}
32+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Collections.Generic;
2+
using UltraWorldAI.Knowledge;
3+
using Xunit;
4+
5+
public class KnowledgeLineageSystemTests
6+
{
7+
[Fact]
8+
public void RegisterLineageStoresSchool()
9+
{
10+
KnowledgeLineageSystem.Schools.Clear();
11+
KnowledgeLineageSystem.RegisterLineage(
12+
"Saren",
13+
"Luz",
14+
new List<string> { "Kael" },
15+
true,
16+
"Luz interior");
17+
18+
Assert.Single(KnowledgeLineageSystem.Schools);
19+
}
20+
21+
[Fact]
22+
public void AddRepressionEventIncrementsCounters()
23+
{
24+
KnowledgeLineageSystem.Schools.Clear();
25+
KnowledgeLineageSystem.RegisterLineage("Saren", "Luz", new List<string>(), true, "");
26+
KnowledgeLineageSystem.AddRepressionEvent("Luz", "caça");
27+
KnowledgeLineageSystem.AddRepressionEvent("Luz", "guerra");
28+
29+
var school = KnowledgeLineageSystem.Schools[0];
30+
Assert.Equal(1, school.Hunts);
31+
Assert.Equal(1, school.Wars);
32+
}
33+
}
34+

0 commit comments

Comments
 (0)