public void Test_EconomyOutput_ReportChaoting() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); var report = Economy.inst.outputs.Single(x => x.name == "STATIC_REPORT_CHAOTING_TAX"); Assert.AreEqual(Root.def.economy.report_chaoting_percent, report.percent.Value); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value, report.maxValue.Value); Assert.AreEqual(report.maxValue.Value * report.percent.Value / 100, report.currValue.Value); report.percent.Value = 12.3; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(12.3, report.percent.Value); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value, report.maxValue.Value); Assert.AreEqual(report.maxValue.Value * report.percent.Value / 100, report.currValue.Value); Date.inst.day.Value = 30; Economy.DaysInc(); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value - report.currValue.Value, Chaoting.inst.oweTax); }
public void Test_ChaotingPowerParty() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(Root.def.chaoting.powerParty, Visitor.Get("chaoting.power_party.type")); }
public void Test_Init() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(init.common.name, Visitor.Get("taishou.name")); Assert.AreEqual(init.common.age, Visitor.Get("taishou.age")); Assert.AreEqual(init.common.party, Visitor.Get("taishou.party.type")); }
public void Test_EconomyMonthSurplus() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(Economy.inst.incomes.Sum(x => x.currValue.Value), Economy.inst.incomes.total.Value); Assert.AreEqual(Economy.inst.outputs.Sum(x => x.currValue.Value), Economy.inst.outputs.total.Value); Assert.AreEqual(Economy.inst.incomes.total.Value - Economy.inst.outputs.total.Value, Economy.inst.monthSurplus.Value); }
public TestEventDepart() { ModDataVisit.InitVisitMap(typeof(Demon)); ModFileSystem.Clear(); var modFileSystem = ModFileSystem.Generate(nameof(TestEventDepart)); modFileSystem.AddDepartEvent("EVENT_TEST.txt", @"title = EVENT_DIFF_TITLE desc = EVENT_DIFF_DESC trigger = { equal = {depart.data1, 11} } date = every_day occur = 1 option = { desc = EVENT_TEST_OPTION_1_DESC select = { assign = {depart.data2, 101} } } option = { desc = EVENT_TEST_OPTION_2_DESC select = { assign = {depart.data2, 102} } } option = { desc = EVENT_TEST_OPTION_3_DESC select = { assign = {depart.data2, 103} } }"); Mod.Load(ModFileSystem.path); }
public void Test_ChaotingOweTax() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(0, Visitor.Get("chaoting.extra_tax")); Assert.AreEqual(0, Visitor.Get("chaoting.owe_tax")); var oweTax = 100.0; Chaoting.inst.ReportMonthTax(Chaoting.inst.expectMonthTaxValue.Value - oweTax); Assert.AreEqual(0, Visitor.Get("chaoting.extra_tax")); Assert.AreEqual(oweTax, Visitor.Get("chaoting.owe_tax")); }
public void Test_EconomyCurrValue() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(Root.def.economy.curr, Visitor.Get("economy.value")); Economy.inst.curr.Value = 100; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(100, Visitor.Get("economy.value")); }
public void Test_EconomyDayInc() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Date.inst.day.Value = 29; Economy.DaysInc(); Assert.AreEqual(Root.def.economy.curr, Visitor.Get("economy.value")); Date.inst.day.Value = 30; Economy.DaysInc(); Assert.AreEqual(Root.def.economy.curr + Economy.inst.monthSurplus.Value, Visitor.Get("economy.value")); }
// Declare member variables here. Examples: // private int a = 2; // private string b = "text"; static StartScene() { System.IO.Directory.CreateDirectory(GlobalPath.save); Root.logger = (value) => GD.Print(value); Mod.logger = (value) => GD.Print(value); ModDataVisit.InitVisitMap(typeof(Root)); Mod.Load(GlobalPath.mod); Root.def = Mod.def; foreach (var mod in Mod.Enumerate()) { TranslateServerEx.AddTranslate(mod.languages); } }
public void Test_EconomyOutput_AdminExpend() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); var adminExpend = Economy.inst.outputs.Single(x => x.name == "STATIC_ADMIN_EXPEND"); Assert.AreEqual(Root.def.economy.expend_depart_admin, adminExpend.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.adminExpendBase.Value), adminExpend.maxValue.Value); Assert.AreEqual(adminExpend.maxValue.Value * adminExpend.percent.Value / 100, adminExpend.currValue.Value); adminExpend.percent.Value = 12.3; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(12.3, adminExpend.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.adminExpendBase.Value), adminExpend.maxValue.Value); Assert.AreEqual(adminExpend.maxValue.Value * adminExpend.percent.Value / 100, adminExpend.currValue.Value); }
public void Test_EconomyInCome_PopTax() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); var popTax = Economy.inst.incomes.Single(x => x.name == "STATIC_POP_TAX"); Assert.AreEqual(Root.def.economy.pop_tax_percent, popTax.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.tax.Value), popTax.maxValue.Value); Assert.AreEqual(popTax.maxValue.Value * popTax.percent.Value / 100, popTax.currValue.Value); popTax.percent.Value = 12.3; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(12.3, popTax.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.tax.Value), popTax.maxValue.Value); Assert.AreEqual(popTax.maxValue.Value * popTax.percent.Value / 100, popTax.currValue.Value); }