123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642 |
- package world
- import (
- "fmt"
- "strings"
- )
- /* Aptitudes of a being, species or profession */
- type Aptitudes struct {
- Skills []BeingSkill
- Arts []BeingArt
- Techniques []BeingTechnique
- Exploits []BeingExploit
- }
- /* Kind of a being or "Kin" for short*/
- type Kin struct {
- Entity
- // Talent modifiers of the species
- Talents
- // Vitals modifiers of the species
- Vitals
- Aptitudes
- // Arts multiplier in %. If zero arts cannot be used.
- Arts float64
- // Technique multiplier in %. If zero techniques cannot be used.
- Techniques float64
- // Learning speed in %
- Learning float64
- // How much of the being is mechanical.
- // Affects healing arts and medication, and the ability to install parts.
- Mechanical float64
- // Level of Corruption
- Corruption float64
- // If players can choose this or not
- Playable bool
- }
- func NewKin(id ID, name string) * Kin {
- res := new(Kin)
- res.ID = id;
- res.Name = name
- return res
- }
- /* Job of a being */
- type Job struct {
- Entity
- // Talent modifiers of the profession
- Talents
- // Vitals modifiers of the profession
- Vitals
- // Map of skills that this job starts with and their levels.
- Skills map[ID] int
- // Same for arts and techniques and exploits
- Arts map[ID] int
- Techniques map[ID] int
- Exploits map[ID] int
- // if a player can choose this or not
- Playable bool
- }
- /* Gender of a being */
- type Gender struct {
- Entity
- // Talent modifiers of the gender
- Talents
- // Vitals modifiers of the gender
- Vitals
- }
- /* Struct, list and map of all genders in WOE. */
- var Genders = struct {
- Female Gender
- Male Gender
- Intersex Gender
- Genderless Gender
- }{
- Gender {
- Entity : Entity{ ID: "female", Name: "Female"},
- Talents : Talents { Agility: 1, Charisma: 1 },
- },
- Gender {
- Entity : Entity{ ID: "male", Name: "Male"},
- Talents : Talents { Strength: 1, Intelligence: 1 },
- },
- Gender {
- Entity : Entity{ ID: "intersex", Name: "Intersex"},
- Talents : Talents { Dexterity: 1, Wisdom: 1 },
- },
- Gender {
- Entity : Entity{ ID: "genderless", Name: "Genderless"},
- Talents : Talents { Toughness: 1, Emotion: 1 },
- },
-
- }
- var GenderList = []*Gender{&Genders.Female, &Genders.Male,
- &Genders.Intersex, &Genders.Genderless }
- var GenderMap = map[ID]*Gender {
- Genders.Female.ID : &Genders.Female,
- Genders.Male.ID : &Genders.Male,
- Genders.Intersex.ID : &Genders.Intersex,
- Genders.Genderless.ID : &Genders.Genderless,
- }
- /* All Kins of WOE */
- var KinList = [] Kin {
- { Entity: Entity {
- ID: "kin_human", Name: "Human",
- Short: "The primordial conscious beings on Earth.",
- Long:
- `Humans are the primordial kind of conscious beings on Earth.
- They excel at nothing in particular, but are fast learners.`,
- },
- // No talents because humans get no talent bonuses
- // No stats either because no bonuses there either.
- Arts : 1.0,
- Playable : true,
- },
- { Entity: Entity {
- ID: "kin_neosa", Name: "Neosa",
- Short: "Nimble beings, skilled in the Arts.",
- Long:
- `Neosa are descendents of humans genetically modified to be lite, agile
- and skilled with the Numen Arts. They are less tough and strong, and less adept
- with techniques`,
- },
-
- // AGI+1 EMO+1 STR-1 TOU-1
- Talents : Talents { Strength : -1, Toughness: -1,
- Agility : 1, Emotion : 1, },
- Arts : 1.2,
- Techniques : 0.8,
- Playable : true,
- },
- { Entity: Entity {
- ID: "kin_mantu", Name: "Mantu",
- Short: "Hardy, stocky beings, skilled in the Techniques.",
- Long:
- `Mantu are descendents of humans genetically modified to be hardy, stocky
- and skilled with Techniques. They are somewhat less agine and less adept with
- Numen Arts than humans.`,
- },
- // STR+1 1 TOU+1 AGI-1 EMO-1
- Talents : Talents { Strength : +1, Toughness: +1,
- Agility : -1, Emotion : -1, },
-
- Arts : 0.8,
- Techniques : 1.2,
- Playable : true,
- },
- { Entity: Entity {
- ID: "kin_cyborg", Name: "Cyborg",
- Short: "Human enhanced with robotic parts. ",
- Long:
- `Cyborgs are humans who either through neccesity or through their own will,
- have been enhanced with robotic parts. They are far more skilled with
- Techniques, and can install some Parts, but their Nummen arts are only half
- as effective. They are partially mechanical and healing arts and medication
- is not as effective on them, but they can be repaired.`,
- },
- // STR+1 1 TOU+1 DEX+1 INT+1
- Talents : Talents { Strength : +1, Toughness: +1,
- Dexterity : +1, Intelligence: +1, },
- Arts : 0.5,
- Techniques : 1.5,
- Mechanical : 0.5,
- Playable : true,
- },
- { Entity: Entity {
- ID: "kin_android", Name: "Android",
- Short: "Human shaped biomchanical robot at the service of humans. ",
- Long:
- `Androids are conscious human shaped robots with the imperative to serve humans.
- Highly effective with Techniques, and can install many Parts, but cannot use
- any Nummen arts. Since thay are not alive, they technically cannot die.`,
- },
- // STR+1 1 TOU+1 DEX+1 INT+1
- Talents : Talents { Strength : +2, Toughness: +2,
- Dexterity : +2, Intelligence: +2, },
- Arts : 0.0,
- Techniques : 2.0,
- Mechanical : 1.0,
- Playable : true,
- },
-
- { Entity: Entity {
- ID: "kin_maverick", Name: "Maverick",
- Short: "Human shaped biomechanical robot running wild. ",
- Long:
- `Mavericks are androids in which the imperative to serve humans has
- been destroyed or disabled. Highly effective with Techniques, and can install
- many Parts, but cannot use any Nummen arts. Since thay are not alive, they
- technically cannot die. They are feared by Humans and hated by Androids.`,
- },
- // STR+1 1 TOU+1 DEX+1 INT+1
- Talents : Talents { Strength : +3, Toughness: +3,
- Dexterity : +2, Intelligence: +2, Charisma: -2 },
- Arts : 0.0,
- Techniques : 2.0,
- Mechanical : 1.0,
- Playable : false,
- },
-
-
- { Entity: Entity {
- ID: "kin_robot", Name: "Robot",
- Short: "Non conscious mechanical robot.",
- Long:
- `In the wars of the past many robots were built for offense or defense.
- Unfortunately, they are self repairing and often even able to replicate
- if they find suitable materials. No wonder they are still prowling
- the Earth millennia after.`,
- },
- // STR+1 1 TOU+1 DEX+1 INT+1
- Talents : Talents { Strength : +4, Toughness: +4,
- Dexterity : +2, Intelligence: +2, Charisma: -4},
- Arts : 0.0,
- Techniques : 2.0,
- Mechanical: 1.0,
- Playable : false,
- },
-
- { Entity: Entity {
- ID: "kin_drone", Name: "Drone",
- Short: "Flying combat robot. ",
- Long:
- `Out of control robots are a pain, out of control flying robots even more so!
- They might be less though than normal robots, but they move extremely quickly.
- `,
- },
- Talents : Talents { Strength : +2, Toughness: +2,
- Agility: +4, Dexterity : +2, Intelligence: +2, Charisma: -4},
- Arts : 0.0,
- Techniques : 2.0,
- Mechanical : 1.0,
- Playable : false,
- },
- { Entity: Entity {
- ID: "kin_turret", Name: "Turret",
- Short: "Immobile automated defense system. ",
- Long:
- `
- The ancients would set up robotic defense system to guard certain areas.
- These defense systems might be immobile, but they are deadly accurate.
- Furthermore they are extremely resillient and self repairing.
- No wonder they are still actve after all these years.
- `,
- },
- Talents : Talents { Strength : +2, Toughness: +4,
- Agility: -4, Dexterity : +4, Intelligence: +4, Charisma: -4},
- Arts : 0.0,
- Techniques : 2.0,
- Mechanical : 1.0,
- Playable : false,
- },
-
- { Entity: Entity {
- ID: "kin_beast", Name: "Beast",
- Short: "Beast that prowls the wild. ",
- Long:
- `Due to the damage to the ecosystem, beasts have rapidly evolved in the last
- 60000 years. As a result, most all of them, even the plant eaters, are ferocious
- and aggressive, to protect themselves and their offspring from Humans.`,
- },
- Talents : Talents { Strength : +2, Toughness: +2,
- Agility : +1, Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_bird", Name: "Bird",
- Short: "Flying being that prowls the wild. ",
- Long:
- `Beasts can be dangerous, flying beasts are all the more so!
- They might be less resillient, but all the more agile.`,
- },
- Talents : Talents { Strength : +1, Toughness: +1,
- Agility : +3, Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_fish", Name: "Fish",
- Short: "Fish like being that swims the seas or rivers. ",
- Long:
- `Now you know why you were always told not to swim in rivers or seas.
- Fish dart through the water, attacking with their razor sharp teeth.
- `,
- },
- Talents : Talents { Strength : +3, Toughness: +2,
- Agility : +2, Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_amphibian", Name: "Amphibian",
- Short: "Being that lives both on land and in the water. ",
- Long:
- `Covered with a slimy skin and often toxic, these being can not only swim
- but also purse you on land.`,
- },
- Talents : Talents { Strength : +1, Toughness: +2,
- Agility : +1, Dexterity: +1, Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_reptile", Name: "Reptile",
- Short: "Scaly creepy crawling beasts.",
- Long:
- `Reptiles have been around for a long time, and it looks they will be around for
- a long time still. They may be slow, especially in colder weather, nevertheless
- they remain dangerous.
- `,
- },
- Talents : Talents { Strength : +2, Toughness: +2,
- Agility: -1, Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_crustacean", Name: "Custacian",
- Short: "Beast protected by a tough shell",
- Long:
- `You might find it hard to inflict any damage to these well armoured beings.
- Their shells protect them against damage and allow them to live in the water
- and as well on the land.`,
- },
- Talents : Talents { Strength : +2, Toughness: +4,
- Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_insect", Name: "Insect",
- Short: "Beast with articulated legs and bodies.",
- Long:
- `The climate of Earth hs shifted dramaticaly over the last 60000 years,
- and as a result, larger creepy crawlers became more successful.
- `,
- },
- Talents : Talents { Strength : +2, Toughness: +4, Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_aquatic", Name: "beast",
- Short: "Aquatic beast. ",
- Long:
- `Whether in the rivers or the deep seas, these soft bodies creatures
- are often toxic and quite dangerous.`,
- },
- Talents : Talents { Strength : +2, Dexterity: +2, Intelligence: -5, },
- },
- { Entity: Entity {
- ID: "kin_corrupted", Name: "corrupted",
- Short: "Beast corupted by Omen. ",
- Long:
- `Some animals became corrupted by Omen. As a result, they became much stronger
- and more resillient. Fortunately, the Omen is weak against certain Numen arts.
- Beware, their attacks might be contageous...`,
- },
- Talents : Talents { Strength : +4, Toughness: +4,
- Agility : +1, Intelligence: -3, Wisdom: -5 },
- },
- { Entity: Entity {
- ID: "kin_deceased", Name: "Deceased",
- Short: "Deceased biological being animated by Omen. ",
- Long:
- `Some living beings become corrupted by Omen to the point that they remain
- animated even after their biological bodies have already stopped functioning.
- Such beings are termed the Deceased. They are resillient, strong and cunning.
- Fortunately, the Omen is weak against certain Numen arts. But beware, their
- attacks might be contageous...
- `,
- },
- Talents : Talents { Strength : +2, Toughness: +2,
- Agility : +1, Intelligence: -1, Wisdom: -7 },
- },
-
- }
- /* All jobs of WOE
- * agent officer guardian
- * worker brawler builder
- * hunter gunsman rogue
- * explorer ranger rebel
- * tinker engineer wrecker
- * homemaker musician trader
- * scholar scientist hacker
- * medic cleric artist
- * esper dilettante (not playable) Danger
- *
- *
- * hunter scholar esper worker medic agent officer cleric guardian ranger wrecker engineer tinker scientist
- *
- *
- *
- Officer STR + 1
- Worker TOU + 1
- Engineer DEX + 1
- Hunter AGI + 1
- Scholar INT + 1
- Doctor WIS +1
- Cleric CHA + 1
- *
- *
- */
- var JobList = [] Job {
- { Entity: Entity {
- ID: "job_hunter", Name: "Hunter",
- Short: "Hunter who chases beasts and mavericks.",
- Long:
- `Hunters protect human settlements from Beasts and Mavericks, and try to keep their numbers down.
- `,
- },
- Talents : Talents { Dexterity: +2 },
- Skills : map[ID] int{ "skill_guns": 10, },
- Playable: true,
- },
- }
- type LabeledPointer struct {
- ID ID
- labeled * Labeled
- }
- type GenderPointer struct {
- ID ID
- gender * Gender
- }
- //}
- /* Vital statistic of a Being. */
- type Vital struct {
- Now int `xml:"N,attr"`
- Max int `xml:"X,attr"`
- }
- /* Report a vital statistic as a Now/Max string */
- func (me * Vital) ToNowMax() string {
- return fmt.Sprintf("%4d/%4d", me.Now , me.Max)
- }
- // alias of the above, since I'm lazy at times
- func (me * Vital) TNM() string {
- return me.ToNowMax()
- }
- /* Report a vital statistic as a rounded percentage */
- func (me * Vital) ToPercentage() string {
- percentage := (me.Now * 100) / me.Max
- return fmt.Sprintf("%d", percentage)
- }
- /* Report a vital statistic as a bar of characters */
- func (me * Vital) ToBar(full string, empty string, length int) string {
- numfull := (me.Now * length) / me.Max
- numempty := length - numfull
- return strings.Repeat(empty, numempty) + strings.Repeat(full, numfull)
- }
- type Talents struct {
- Strength int `xml:"Talents>STR,omitempty"`
- Toughness int `xml:"Talents>TOU,omitempty"`
- Agility int `xml:"Talents>AGI,omitempty"`
- Dexterity int `xml:"Talents>DEX,omitempty"`
- Intelligence int `xml:"Talents>INT,omitempty"`
- Wisdom int `xml:"Talents>WIS,omitempty"`
- Charisma int `xml:"Talents>CHA,omitempty"`
- Emotion int `xml:"Talents>EMO,omitempty"`
- }
-
- type Vitals struct {
- HP Vital
- MP Vital
- JP Vital
- LP Vital
- }
- type EquipmentValues struct {
- Offense int
- Protection int
- Block int
- Rapidity int
- Yield int
- }
- type Being struct {
- Entity
-
- // Essentials
- Gender
- Kin
- Job
- Level int
-
- // A being has talents.
- Talents
- // A being has vitals
- Vitals
- // A being has Equipment values
- EquipmentValues
- // A being has aptitudes
- Aptitudes
-
- // Skills array
- // Skills []Skill
-
- // Arts array
- // Arts []Art
- // Affects array
- // Affects []Affect
-
- // Equipment
- // Equipment
-
- // Inventory
- Inventory Inventory
-
- // Location pointer
- room * Room
-
- }
- // Derived stats
- func (me *Being) Force() int {
- return (me.Strength * 2 + me.Wisdom) / 3
- }
-
- func (me *Being) Vitality() int {
- return (me.Toughness * 2 + me.Charisma) / 3
- }
- func (me *Being) Quickness() int {
- return (me.Agility * 2 + me.Intelligence) / 3
- }
- func (me * Being) Knack() int {
- return (me.Dexterity * 2 + me.Emotion) / 3
- }
-
-
- func (me * Being) Understanding() int {
- return (me.Intelligence * 2 + me.Toughness) / 3
- }
- func (me * Being) Grace() int {
- return (me.Charisma * 2 + me.Agility) / 3
- }
-
- func (me * Being) Zeal() int {
- return (me.Wisdom * 2 + me.Strength) / 3
- }
- func (me * Being) Numen() int {
- return (me.Emotion * 2 + me.Dexterity) / 3
- }
- // Generates a prompt for use with the being/character
- func (me * Being) ToPrompt() string {
- if me.Emotion > 0 {
- return fmt.Sprintf("HP:%s MP:%s JP:%s LP:%s", me.HP.TNM(), me.MP.TNM(), me.JP.TNM, me.LP.TNM())
- } else {
- return fmt.Sprintf("HP:%s MP:%s LP:%s", me.HP.TNM(), me.MP.TNM(), me.LP.TNM())
- }
- }
- // Generates an overview of the essentials of the being as a string.
- func (me * Being) ToEssentials() string {
- return fmt.Sprintf("%s lvl %d %s %s %s", me.Name, me.Level, me.Gender.Name, me.Kin.Name, me.Job.Name)
- }
- // Generates an overview of the physical talents of the being as a string.
- func (me * Being) ToBodyTalents() string {
- return fmt.Sprintf("STR: %3d TOU: %3d AGI: %3d DEX: %3d", me.Strength, me.Toughness, me.Agility, me.Dexterity)
- }
- // Generates an overview of the mental talents of the being as a string.
- func (me * Being) ToMindTalents() string {
- return fmt.Sprintf("INT: %3d WIS: %3d CHA: %3d EMO: %3d", me.Intelligence, me.Wisdom, me.Charisma, me.Emotion)
- }
- // Generates an overview of the equipment values of the being as a string.
- func (me * Being) ToEquipmentValues() string {
- return fmt.Sprintf("OFF: %3d PRO: %3d BLO: %3d RAP: %3d YIE: %3d", me.Offense, me.Protection, me.Block, me.Rapidity, me.Yield)
- }
- // Generates an overview of the status of the being as a string.
- func (me * Being) ToStatus() string {
- status := me.ToEssentials()
- status += "\n" + me.ToBodyTalents();
- status += "\n" + me.ToMindTalents();
- status += "\n" + me.ToEquipmentValues();
- status += "\n" + me.ToPrompt();
- status += "\n"
- return status
- }
- func (me *Being) Type() string {
- return "being"
- }
- func (me *Being) Save(datadir string) {
- SaveSavable(datadir, me)
- }
- func LoadBeing(datadir string, nameid string) * Being {
- res, _ := LoadLoadable(datadir, nameid, new(Being)).(*Being)
- return res
- }
|