Skip to content
Permalink
Browse files

Improved spells

  • Loading branch information...
Depado committed Sep 13, 2017
1 parent 9d63619 commit a541d10dfd1f53f551cd716b79c902ceed811f30
Showing with 378 additions and 41 deletions.
  1. +1 −0 assets/img/hourglass.svg
  2. +1 −0 assets/img/radius.svg
  3. +1 −0 assets/img/rank.svg
  4. +2 −1 { → chars}/nogaj.yml
  5. +241 −0 chars/sighilde.yml
  6. +13 −1 main.go
  7. +0 −8 models/character.go
  8. +26 −0 models/dice.go
  9. +40 −0 models/load.go
  10. +9 −11 models/talents.go
  11. +44 −20 templates/spells.tmpl
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="transparent" opacity="0"></path><g class="" style="touch-action: none;" transform="translate(0,0)"><path fill="#000000" opacity="0.54" d="M388.656 21.406L76.876 72.063 80.56 95l311.813-50.656-3.72-22.938zM375.312 66.03l-18.437 3 16.25 100.282c-7.01 4.713-11.034 13.208-9.594 22.094.474 2.913 1.5 5.587 2.94 7.97 5.55-4.228 12.173-7.207 19.5-8.407h.06c2.25-.367 4.475-.546 6.69-.564.737-.006 1.485 0 2.217.03 4.273.182 8.436.995 12.375 2.345.62-2.72.724-5.61.25-8.53-1.433-8.843-7.885-15.59-15.968-17.875L375.314 66.03zM332.406 73L148.25 102.938c9.082 42.138 25.73 78.544 45.72 103.843 22.553 28.546 48.246 42.31 71.874 38.47 23.628-3.84 43.653-25.027 56.03-59.25 10.974-30.34 15.237-70.14 10.532-113zM123 107.03l-18.438 3 16.344 100.72c-6.837 4.75-10.734 13.14-9.312 21.906.457 2.82 1.446 5.43 2.812 7.75 5.593-4.288 12.283-7.297 19.688-8.5 2.25-.365 4.474-.545 6.687-.562.74-.006 1.488 0 2.22.03 4.293.183 8.482.983 12.438 2.345.56-2.633.644-5.403.187-8.22-1.456-8.977-8.087-15.82-16.344-18L123 107.03zm269.938 102.032c-1.288.012-2.592.13-3.907.344-14.024 2.28-23.4 15.275-21.124 29.313 2.276 14.036 15.257 23.403 29.28 21.124 14.026-2.28 23.402-15.275 21.127-29.313-1.992-12.282-12.182-20.98-24.094-21.436-.427-.017-.853-.035-1.283-.03zM141 250c-1.287.012-2.59.13-3.906.344-14.025 2.28-23.4 15.275-21.125 29.312 2.275 14.038 15.255 23.404 29.28 21.125 14.025-2.278 23.4-15.274 21.125-29.31-1.99-12.284-12.182-20.982-24.094-21.44-.424-.015-.85-.034-1.28-.03zm134.656 13.844c-2.244.054-4.472.265-6.687.625-23.63 3.84-43.654 25.057-56.033 59.28-11.165 30.868-15.416 71.534-10.312 115.25L387 409.062c-8.967-43.092-25.812-80.345-46.156-106.093-19.735-24.98-41.883-38.67-62.938-39.126-.752-.017-1.502-.018-2.25 0zm144.094 6.03c-5.567 4.238-12.213 7.213-19.563 8.407-7.386 1.2-14.665.472-21.312-1.81-.606 2.7-.72 5.57-.25 8.467 1.447 8.927 7.996 15.75 16.188 17.97l16.562 102.187 18.438-3-16.594-102.313c6.896-4.736 10.864-13.16 9.436-21.967-.47-2.896-1.477-5.567-2.906-7.938zm-252.063 41.032c-5.54 4.187-12.143 7.128-19.437 8.313-7.352 1.193-14.597.476-21.22-1.783-.666 2.79-.83 5.742-.343 8.75 1.427 8.8 7.816 15.528 15.844 17.844l16.532 102.064 18.438-3-16.53-101.875c7.103-4.692 11.2-13.24 9.75-22.19-.484-2.975-1.542-5.71-3.032-8.124zM452.844 417.28L141.063 467.94l3.687 22.937 311.813-50.656-3.72-22.94z"></path></g><!-- react-empty: 6 --></svg>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="transparent" opacity="0"></path><g class="" style="touch-action: none;" transform="translate(0,0)"><path fill="#000000" opacity="0.54" d="M256 48c-29.077 0-56.755 5.975-81.887 16.75h163.774C312.755 53.975 285.077 48 256 48zM130.34 90.25c-10.07 7.646-19.424 16.18-27.938 25.5h307.196c-8.514-9.32-17.87-17.854-27.938-25.5H130.34zm-47.834 51c-5.38 8.12-10.21 16.635-14.428 25.5h375.844c-4.218-8.865-9.048-17.38-14.43-25.5H82.506zm-24.54 51c-2.665 8.286-4.826 16.797-6.443 25.5H460.48c-1.62-8.703-3.782-17.214-6.447-25.5H57.967zm-9.566 51c-.255 4.22-.4 8.467-.4 12.75 0 4.283.145 8.53.4 12.75h415.2c.255-4.22.4-8.467.4-12.75 0-4.283-.146-8.53-.4-12.75H48.4zm3.123 51c1.618 8.703 3.78 17.214 6.444 25.5h396.066c2.665-8.286 4.826-16.797 6.444-25.5H51.523zm16.555 51c4.218 8.864 9.05 17.38 14.43 25.5h346.986c5.382-8.12 10.212-16.636 14.43-25.5H68.078zm34.324 51c8.514 9.32 17.87 17.854 27.94 25.5H381.66c10.068-7.646 19.424-16.18 27.938-25.5H102.402zm71.71 51C199.246 458.025 226.923 464 256 464c29.076 0 56.755-5.975 81.887-16.75H174.113z"></path></g><!-- react-empty: 6 --></svg>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="transparent" opacity="0"></path><g class="" style="touch-action: none;" transform="translate(0,0)"><path fill="#000000" opacity="0.54" d="M255.977 121.95C226.38 169.626 161.382 247.503 106 286.446v52.48c38 29.073 86 51.098 150 51.124 64 .027 112-22.05 150-51.124V286.51c-56.388-38.936-120.655-116.947-150.023-164.56zm.023 57.523l9.44 14.158c27.838 41.76 66.42 83.7 107.26 118.774-46.064 25.842-81.895 37.647-116.7 37.647-34.718 0-70.455-11.744-116.352-37.45 40.87-35.015 79.02-77.128 106.913-118.97l9.44-14.157z"></path></g><!-- react-empty: 6 --></svg>
@@ -39,10 +39,11 @@ spells:
- name: Heal
description: Jagon heals you or someone else
test: Willpower
rank: 1
score:
throws: 1
type: 10
per_rank: true
ranked: true
stats:
- name: CC
base: 26
@@ -0,0 +1,241 @@
name: "Sighilde"
age: 25
race: Human
height: 165
weight: 55
prefered_hand: Right
xps: 4280
spent_xps: 3250
hit_points: 19
fatigue: 3
force_points: 5
wealth:
carried:
platinum: 0
gold: 122
silver: 0
bronze: 87
formations:
- name: Guns
description: Increase base shooting skill with guns
modifier: 10
- name: Riffles
description: Increase base shooting skill with riffles
modifier: 10
- name: Drunk Man Technique
description: Close combat style
talents:
- name: Evangelism
description: Give some skills because of faith.
- name: Sniper
description: Remove some penalties for long-distance shooting
- name: Ammo Crafting
description: Allows to craft ammunitions
- name: Decadence
description: Improved alcohol resistance
spells:
- name: Create Water
description: Create up to 2 galons of water per rank
test: Willpower
rank: 0
- name: Bless Water
description: Bless of flask of water by touching it. (1 minute)
test: Willpower
rank: 1
ingredients:
- Water
- name: Cure Light Wound
description: Heal one creature by touching it.
rank: 1
test: Willpower
score:
throws: 1
type: 8
ranked: true
modifier: 1
ranked_modifier: true
- name: Cure Moderate Wound
description: Heal one creature by touching it.
test: Willpower
rank: 2
score:
throws: 2
ranked: true
type: 8
modifier: 1
ranked_modifier: true
- name: Obscuring Mist
description: Create an obscuring mist
duration: 1 minute per rank
size: 20ft radius
rank: 1
test: Willpower
- name: Remove Paralysis
description: Cures the paralysis status
size: 4 creatures (< 30 ft appart)
rank: 2
test: Willpower
- name: Grease
rank: 1
description: Covers a solid surface with a layer of slippery grease.
test: Willpower
size: 25ft + 5ft per 2 ranks
- name: Zone of Truth
rank: 2
description: Creatures within the emanation area (or those who enter it) can’t speak any deliberate and intentional lies.
size: 20ft radius
test: Willpower
- name: Comprehend Language
rank: 1
description: You can understand the spoken words of creatures or read otherwise incomprehensible written messages. In either case, you must touch the creature or the writing.
test: Willpower
duration: 10min per rank
- name: Shield of Faith
description: +2 CA with a bonus of +1 every 6 rank
duration: 1min per rank
test: Willpower
rank: 1
stats:
- name: CC
base: 26
rank: C
- name: CT
base: 54
modifier: 10
rank: A
- name: Strength
base: 29
rank: C
- name: Agility
base: 56
rank: A
modifier: 10
- name: Stamina
base: 33
rank: B
modifier: 5
- name: Intelligence
base: 31
rank: C
- name: Perception
base: 42
rank: A
modifier: 10
- name: Sociability
base: 34
rank: B
- name: Willpower
base: 60
rank: A
modifier: 10
skills:
- name: Athlétisme
- name: Acrobatie
modifier: 5
- name: Évasion
- name: Baratin
modifier: 5
- name: Discretion
- name: Enquête
modifier: 5
- name: Fouille
modifier: 5
- name: Observation
modifier: 5
- name: Premier Soins
- name: Sang-froid
- name: Survie
- name: Connaissances (Astronomie)
- name: Connaissances (Archipels)
- name: Connaissances (Foi)
- name: Médecine
- name: Réparation / Mécanique (Serrure)
modifier: 5
- name: Subterfuge

equipment:
weapons:
- name: Krain
type: Hammer
damage:
throws: 10
type: 10
notes:
- Use AGI instead of CC
modifiers:
- "+10 AGI when equiped"
description: A hammer that has the power of thunder.
- name: Épée +2
type: Sword
damage:
throws: 4
type: 6
description: Swords found in an elvish temple or something like that.
ranged_weapons:
- name: Railamagun
type: Gun
scope: 10
damage:
throws: 5
type: 6
notes:
- 4 shots per turn, 2 when aiming
- Piercing effect every 10 damages
modifiers:
- "+10 CT when equiped"
description: |
A large gun that has been enhanced by melting one of the two thunder
hammers on it. Now it only uses the electricty generated by this
material to fire its projectiles.
- name: Dagues de jet
type: Daggers
damage:
throws: 2
type: 4
description: Daggers that I have never used. Like, ever.
jacket:
- name: Cuir
description: Simple veste en cuir solide
inventory:
- name: Rations
quantity: 10
description: Permet de se sustenter
- name: Lampe
quantity: 1
description: Lampe à huile
- name: Huile
quantity: 50
unit: cl
description: Huile inflammable
- name: Bandages
quantity: 10
unit: m
description: Bandages pour soigner les blessures
- name: Onguent
quantity: 1
unit: L
description: Onguent pour soigner les blessures
- name: Sac de couchage
quantity: 1
description: Permet de dormir correctement à même le sol
- name: Kit d'escalade
description: Contient des crochets d'escalade ainsi qu'un grapin
quantity: 1
- name: Briquet
quantity: 1
description: Briquet à amadou
- name: Acid Flask
quantity: 8
description: Flasque remplie d'acide
- name: Livre d'histoire naine
quantity: 2
description: Livre trouvé dans les mines
- name: Livres anciens
quantity: 2
description: Livres trouvés je sais plus où
- name: Dard d'abeille géante
quantity: 1
description: Un dard géant



14 main.go
@@ -15,8 +15,13 @@ func main() {
var err error
var nogaj models.Character

cm, err := models.NewCharMapFromGlob("chars/*.yml")
if err != nil {
logrus.WithError(err).Fatal("Couldn't load chars from glob")
}

// Loading character
if err = nogaj.Load("nogaj.yml"); err != nil {
if err = nogaj.Load("chars/nogaj.yml"); err != nil {
logrus.WithError(err).WithField("file", "nogaj.yml").Fatal("Couldn't load char")
}

@@ -37,6 +42,13 @@ func main() {
r.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl", nogaj)
})
r.GET("/char/:name", func(c *gin.Context) {
if char, ok := cm[c.Param("name")]; ok {
c.HTML(http.StatusOK, "index.tmpl", char)
} else {
c.JSON(http.StatusNotFound, gin.H{"status": http.StatusNotFound, "message": "char not found"})
}
})

// Running server
if err = r.Run(fmt.Sprintf("%s:%d", conf.C.Host, conf.C.Port)); err != nil {
@@ -74,14 +74,6 @@ func (c *Character) Enrich() {
}
}

// DiceThrow defines the way dice throws are represented
// For exemple 10D10 → Throws: 10, Type: 10
type DiceThrow struct {
Throws int `yaml:"throws"`
Type int `yaml:"type"`
PerRank bool `yaml:"per_rank"`
}

// Stat can be a main stat or an extra stat (in which case, rank and base
// are not taken into account)
type Stat struct {
@@ -0,0 +1,26 @@
package models

import "fmt"

// DiceThrow defines the way dice throws are represented
// For exemple 10D10 → Throws: 10, Type: 10
type DiceThrow struct {
Throws int `yaml:"throws"`
Type int `yaml:"type"`
Ranked bool `yaml:"ranked"`
Modifier int `yaml:"modifier"`
RankedModifier bool `yaml:"ranked_modifier"`
FmtModifier string
}

// Format formats the dice throw
func (d *DiceThrow) Format() {
if d.Modifier > 0 {
d.FmtModifier = fmt.Sprintf("+ %d", d.Modifier)
} else if d.Modifier < 0 {
d.FmtModifier = fmt.Sprintf("- %d", d.Modifier)
}
if d.RankedModifier {
d.FmtModifier = d.FmtModifier + " per rank"
}
}
@@ -0,0 +1,40 @@
package models

import (
"path/filepath"
"strings"

"github.com/pkg/errors"
)

// CharMap is a map holding Characters based on the name of the yaml file they
// are stored in
type CharMap map[string]Character

// LoadGlob will load all the characters that matches the given unix shell
// pattern
func (cm CharMap) LoadGlob(pattern string) error {
var err error
var tl []string

if tl, err = filepath.Glob(pattern); err != nil {
return errors.Wrap(err, "glob error")
}
for _, v := range tl {
var c Character
cn := strings.TrimSuffix(filepath.Base(v), filepath.Ext(v))
if err = c.Load(v); err != nil {
return errors.Wrap(err, "couldn't load char")
}
cm[cn] = c
}
return err
}

// NewCharMapFromGlob creates a new CharMap and loads all the characters
// that matches the unix shell pattern inside it
func NewCharMapFromGlob(pattern string) (CharMap, error) {
cm := make(CharMap)
err := cm.LoadGlob(pattern)
return cm, err
}

0 comments on commit a541d10

Please sign in to comment.
You can’t perform that action at this time.