|
|
|
@ -4,6 +4,7 @@ import ( |
|
|
|
|
"mazeratsgen/internal/data" |
|
|
|
|
"mazeratsgen/internal/dice" |
|
|
|
|
"mazeratsgen/internal/helpers" |
|
|
|
|
"strings" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
type NPCTable struct { |
|
|
|
@ -32,31 +33,30 @@ type NPC struct { |
|
|
|
|
Misfortunes []string |
|
|
|
|
Missions []string |
|
|
|
|
Methods []string |
|
|
|
|
Seed int64 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func GenNPC(seed int64) NPC { |
|
|
|
|
roller := dice.NewRoller(seed) |
|
|
|
|
npcTable := NPCTable{Roller: roller} |
|
|
|
|
func (t *NPCTable) Generate() NPC { |
|
|
|
|
var occupation, class, gender string |
|
|
|
|
|
|
|
|
|
occupationRoll, _ := roller.Roll("1d3") |
|
|
|
|
occupationRoll, _ := t.Roller.Roll("1d3") |
|
|
|
|
switch occupationRoll[0] { |
|
|
|
|
case 1: |
|
|
|
|
occupation = npcTable.CivilizedNPC(roller.TableRoll()) |
|
|
|
|
occupation = t.CivilizedNPC(t.Roller.TableRoll()) |
|
|
|
|
case 2: |
|
|
|
|
occupation = npcTable.UnderworldNPC(roller.TableRoll()) |
|
|
|
|
occupation = t.UnderworldNPC(t.Roller.TableRoll()) |
|
|
|
|
case 3: |
|
|
|
|
occupation = npcTable.WildernessNPC(roller.TableRoll()) |
|
|
|
|
occupation = t.WildernessNPC(t.Roller.TableRoll()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
classRoll, _ := roller.Roll("1d2") |
|
|
|
|
classRoll, _ := t.Roller.Roll("1d2") |
|
|
|
|
if classRoll[0] == 1 { |
|
|
|
|
class = "Upperclass" |
|
|
|
|
} else { |
|
|
|
|
class = "Lowerclass" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
genderRoll, _ := roller.Roll("1d2") |
|
|
|
|
genderRoll, _ := t.Roller.Roll("1d2") |
|
|
|
|
if genderRoll[0] == 1 { |
|
|
|
|
gender = "Male" |
|
|
|
|
} else { |
|
|
|
@ -64,59 +64,105 @@ func GenNPC(seed int64) NPC { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return NPC{ |
|
|
|
|
Name: GenName(class, gender, seed).FullName, |
|
|
|
|
Name: GenName(class, gender, t.Roller.Seed).FullName, |
|
|
|
|
Gender: gender, |
|
|
|
|
Occupation: occupation, |
|
|
|
|
Class: class, |
|
|
|
|
Gender: gender, |
|
|
|
|
Appearance: npcTable.Appearance(roller.TableRoll()), |
|
|
|
|
PhysicalDetail: npcTable.PhysicalDetail(roller.TableRoll()), |
|
|
|
|
Clothing: npcTable.Clothing(roller.TableRoll()), |
|
|
|
|
Personality: npcTable.Personality(roller.TableRoll()), |
|
|
|
|
Mannerism: npcTable.Mannerism(roller.TableRoll()), |
|
|
|
|
Secret: npcTable.Secret(roller.TableRoll()), |
|
|
|
|
Reputation: npcTable.Reputation(roller.TableRoll()), |
|
|
|
|
Relationship: npcTable.Relationship(roller.TableRoll()), |
|
|
|
|
Hobby: npcTable.Hobby(roller.TableRoll()), |
|
|
|
|
DivineDomain: npcTable.DivineDomain(roller.TableRoll()), |
|
|
|
|
AfterTheParty: npcTable.AfterTheParty(roller.TableRoll()), |
|
|
|
|
Assets: helpers.GenUniqueItems(3, npcTable.Asset, seed), |
|
|
|
|
Liabilities: helpers.GenUniqueItems(3, npcTable.Liability, seed), |
|
|
|
|
Goals: helpers.GenUniqueItems(3, npcTable.NPCGoal, seed), |
|
|
|
|
Misfortunes: helpers.GenUniqueItems(3, npcTable.Misfortune, seed), |
|
|
|
|
Missions: helpers.GenUniqueItems(3, npcTable.Mission, seed), |
|
|
|
|
Methods: helpers.GenUniqueItems(3, npcTable.Method, seed), |
|
|
|
|
Appearance: t.Appearance(t.Roller.TableRoll()), |
|
|
|
|
PhysicalDetail: t.PhysicalDetail(t.Roller.TableRoll()), |
|
|
|
|
Clothing: t.Clothing(t.Roller.TableRoll()), |
|
|
|
|
Personality: t.Personality(t.Roller.TableRoll()), |
|
|
|
|
Mannerism: t.Mannerism(t.Roller.TableRoll()), |
|
|
|
|
Secret: t.Secret(t.Roller.TableRoll()), |
|
|
|
|
Reputation: t.Reputation(t.Roller.TableRoll()), |
|
|
|
|
Relationship: t.Relationship(t.Roller.TableRoll()), |
|
|
|
|
Hobby: t.Hobby(t.Roller.TableRoll()), |
|
|
|
|
DivineDomain: t.DivineDomain(t.Roller.TableRoll()), |
|
|
|
|
AfterTheParty: t.AfterTheParty(t.Roller.TableRoll()), |
|
|
|
|
Assets: helpers.GenUniqueItems(3, t.Asset, t.Roller.Seed), |
|
|
|
|
Liabilities: helpers.GenUniqueItems(3, t.Liability, t.Roller.Seed), |
|
|
|
|
Goals: helpers.GenUniqueItems(3, t.NPCGoal, t.Roller.Seed), |
|
|
|
|
Misfortunes: helpers.GenUniqueItems(3, t.Misfortune, t.Roller.Seed), |
|
|
|
|
Missions: helpers.GenUniqueItems(3, t.Mission, t.Roller.Seed), |
|
|
|
|
Methods: helpers.GenUniqueItems(3, t.Method, t.Roller.Seed), |
|
|
|
|
Seed: t.Roller.Seed, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) CivilizedNPC(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Template() string { |
|
|
|
|
return strings.TrimSpace(` |
|
|
|
|
Name: {{.Name}} |
|
|
|
|
Gender: {{.Gender}} |
|
|
|
|
Class: {{.Class}} |
|
|
|
|
Occupation: {{.Occupation}} |
|
|
|
|
Appearance: {{.Appearance}} |
|
|
|
|
Physical Detail: {{.PhysicalDetail}} |
|
|
|
|
Clothing: {{.Clothing}} |
|
|
|
|
Personality: {{.Personality}} |
|
|
|
|
Mannerism: {{.Mannerism}} |
|
|
|
|
Secret: {{.Secret}} |
|
|
|
|
Reputation: {{.Reputation}} |
|
|
|
|
Relationship: {{.Relationship}} |
|
|
|
|
Hobby: {{.Hobby}} |
|
|
|
|
Divine Domain: {{.DivineDomain}} |
|
|
|
|
After The Party: {{.AfterTheParty}} |
|
|
|
|
Assets: |
|
|
|
|
{{- range $asset := .Assets }} |
|
|
|
|
{{$asset}} |
|
|
|
|
{{- end}} |
|
|
|
|
Liabilities: |
|
|
|
|
{{- range $liability := .Liabilities }} |
|
|
|
|
{{$liability}} |
|
|
|
|
{{- end}} |
|
|
|
|
Goal: |
|
|
|
|
{{- range $goal := .Goals }} |
|
|
|
|
{{$goal}} |
|
|
|
|
{{- end}} |
|
|
|
|
Misfortunes: |
|
|
|
|
{{- range $misfortune := .Misfortunes }} |
|
|
|
|
{{$misfortune}} |
|
|
|
|
{{- end}} |
|
|
|
|
Missions: |
|
|
|
|
{{- range $mission := .Missions }} |
|
|
|
|
{{$mission}} |
|
|
|
|
{{- end}} |
|
|
|
|
Methods: |
|
|
|
|
{{- range $method := .Methods }} |
|
|
|
|
{{$method}} |
|
|
|
|
{{- end}} |
|
|
|
|
Seed: {{.Seed}} |
|
|
|
|
`) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t *NPCTable) CivilizedNPC(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.CivilizedNPCs[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) UnderworldNPC(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) UnderworldNPC(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.UnderworldNPCs[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) WildernessNPC(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) WildernessNPC(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.WildernessNPCs[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) FemaleName(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) FemaleName(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.FemaleNames[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) MaleName(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) MaleName(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.MaleNames[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) UpperClassSurname(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) UpperClassSurname(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.UpperClassSurnames[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) LowerClassSurname(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) LowerClassSurname(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.LowerClassSurnames[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Asset(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Asset(tableRole [2]int) string { |
|
|
|
|
switch tableRole { |
|
|
|
|
case [2]int{2, 3}: |
|
|
|
|
return "Leader of existing faction" |
|
|
|
@ -127,7 +173,7 @@ func (t NPCTable) Asset(tableRole [2]int) string { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Liability(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Liability(tableRole [2]int) string { |
|
|
|
|
switch tableRole { |
|
|
|
|
case [2]int{3, 1}: |
|
|
|
|
return MagicTable{Roller: t.Roller}.Insanity(t.Roller.TableRoll()) |
|
|
|
@ -136,7 +182,7 @@ func (t NPCTable) Liability(tableRole [2]int) string { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) NPCGoal(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) NPCGoal(tableRole [2]int) string { |
|
|
|
|
treasureTable := TreasureTable{Roller: t.Roller} |
|
|
|
|
switch tableRole { |
|
|
|
|
case [2]int{1, 3}: |
|
|
|
@ -172,39 +218,39 @@ func (t NPCTable) NPCGoal(tableRole [2]int) string { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Misfortune(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Misfortune(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Misfortunes[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Mission(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Mission(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Missions[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Method(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Method(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Methods[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Appearance(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Appearance(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Appearances[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) PhysicalDetail(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) PhysicalDetail(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.PhysicalDetails[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Clothing(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Clothing(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Clothing[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Personality(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Personality(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Personalities[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Mannerism(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Mannerism(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Mannerisms[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Secret(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Secret(tableRole [2]int) string { |
|
|
|
|
switch tableRole { |
|
|
|
|
case [2]int{4, 5}: |
|
|
|
|
return t.Misfortune(t.Roller.TableRoll()) |
|
|
|
@ -215,19 +261,19 @@ func (t NPCTable) Secret(tableRole [2]int) string { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Reputation(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Reputation(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Reputations[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Hobby(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Hobby(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Hobbies[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) Relationship(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) Relationship(tableRole [2]int) string { |
|
|
|
|
return data.Tables.NPC.Relationships[tableRole[0]-1][tableRole[1]-1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) DivineDomain(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) DivineDomain(tableRole [2]int) string { |
|
|
|
|
switch tableRole { |
|
|
|
|
case [2]int{1, 1}: |
|
|
|
|
roll, _ := t.Roller.Roll("1d6") |
|
|
|
@ -242,7 +288,7 @@ func (t NPCTable) DivineDomain(tableRole [2]int) string { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t NPCTable) AfterTheParty(tableRole [2]int) string { |
|
|
|
|
func (t *NPCTable) AfterTheParty(tableRole [2]int) string { |
|
|
|
|
switch tableRole { |
|
|
|
|
case [2]int{3, 3}: |
|
|
|
|
return "Insulted an existing faction" |
|
|
|
|