Added flower types.

This commit is contained in:
Sander Schobers 2020-05-11 00:00:35 +02:00
parent 1c208152e8
commit 3407a93586
4 changed files with 113 additions and 24 deletions

View File

@ -70,26 +70,26 @@ flower-anemone-2: images/flower_yellowC_NW.png
flower-anemone-3: images/flower_yellowC_SW.png
flower-anemone-4: images/flower_yellowC_SE.png
flower-red-c-disabled: images/flower_redC_NE_disabled.png
flower-red-c-1: images/flower_redC_NE.png
flower-red-c-2: images/flower_redC_NW.png
flower-red-c-3: images/flower_redC_SW.png
flower-red-c-4: images/flower_redC_SE.png
flower-loosestrife-disabled: images/flower_redC_NE_disabled.png
flower-loosestrife-1: images/flower_redC_NE.png
flower-loosestrife-2: images/flower_redC_NW.png
flower-loosestrife-3: images/flower_redC_SW.png
flower-loosestrife-4: images/flower_redC_SE.png
flower-red-a-disabled: images/flower_redA_NE_disabled.png
flower-red-a-1: images/flower_redA_NE.png
flower-red-a-2: images/flower_redA_NW.png
flower-red-a-3: images/flower_redA_SW.png
flower-red-a-4: images/flower_redA_SE.png
flower-tulip-disabled: images/flower_redA_NE_disabled.png
flower-tulip-1: images/flower_redA_NE.png
flower-tulip-2: images/flower_redA_NW.png
flower-tulip-3: images/flower_redA_SW.png
flower-tulip-4: images/flower_redA_SE.png
flower-purple-a-disabled: images/flower_purpleA_NE_disabled.png
flower-purple-a-1: images/flower_purpleA_NE.png
flower-purple-a-2: images/flower_purpleA_NW.png
flower-purple-a-3: images/flower_purpleA_SW.png
flower-purple-a-4: images/flower_purpleA_SE.png
flower-ajuga-disabled: images/flower_purpleA_NE_disabled.png
flower-ajuga-1: images/flower_purpleA_NE.png
flower-ajuga-2: images/flower_purpleA_NW.png
flower-ajuga-3: images/flower_purpleA_SW.png
flower-ajuga-4: images/flower_purpleA_SE.png
flower-purple-c-disabled: images/flower_purpleC_NE_disabled.png
flower-purple-c-1: images/flower_purpleC_NE.png
flower-purple-c-2: images/flower_purpleC_NW.png
flower-purple-c-3: images/flower_purpleC_SW.png
flower-purple-c-4: images/flower_purpleC_SE.png
flower-coneflower-disabled: images/flower_purpleC_NE_disabled.png
flower-coneflower-1: images/flower_purpleC_NE.png
flower-coneflower-2: images/flower_purpleC_NW.png
flower-coneflower-3: images/flower_purpleC_SW.png
flower-coneflower-4: images/flower_purpleC_SE.png

View File

@ -38,10 +38,62 @@ func NewPoppyTraits() FlowerTraits {
Spread: 0.0004,
Life: 0.99993,
Resistance: FlowerResistance{
Cold: 0.5,
Cold: 0.7,
Hot: 0.7,
Dry: 0.5,
Wet: 0.7,
Wet: 0.5,
},
}
}
func NewLoosestrifeTraits() FlowerTraits {
return FlowerTraits{
Spread: 0.0005,
Life: 0.99993,
Resistance: FlowerResistance{
Cold: 0.7,
Hot: 0.6,
Dry: 0.5,
Wet: 0.8,
},
}
}
func NewTulipTraits() FlowerTraits {
return FlowerTraits{
Spread: 0.0005,
Life: 0.99993,
Resistance: FlowerResistance{
Cold: 0.8,
Hot: 0.6,
Dry: 0.5,
Wet: 0.8,
},
}
}
func NewConeflowerTraits() FlowerTraits {
return FlowerTraits{
Spread: 0.0005,
Life: 0.99993,
Resistance: FlowerResistance{
Cold: 0.7,
Hot: 0.8,
Dry: 0.9,
Wet: 0.5,
},
}
}
func NewAjugaTraits() FlowerTraits {
return FlowerTraits{
Spread: 0.0007,
Life: 0.99991,
Resistance: FlowerResistance{
Cold: 0.9,
Hot: 0.5,
Dry: 0.75,
Wet: 0.75,
},
}
}

36
game.go
View File

@ -49,6 +49,42 @@ func NewGame() *Game {
Traits: NewPoppyTraits(),
Unlocked: true,
})
herbarium.Add("loosestrife", FlowerDescriptor{
Name: "Loosestrife",
Description: "A simple flower that will spread in temperate and wet climates.",
IconTemplate: "flower-loosestrife-%s",
BuyPrice: 100,
SellPrice: 20,
Traits: NewLoosestrifeTraits(),
Unlocked: false,
})
herbarium.Add("tulip", FlowerDescriptor{
Name: "Tulip",
Description: "A lovely flower that prefers a bit humid and colder climates.",
IconTemplate: "flower-tulip-%s",
BuyPrice: 500,
SellPrice: 100,
Traits: NewTulipTraits(),
Unlocked: false,
})
herbarium.Add("coneflower", FlowerDescriptor{
Name: "Coneflower",
Description: "A beautifull flower that can withstand hotter climates.",
IconTemplate: "flower-coneflower-%s",
BuyPrice: 20000,
SellPrice: 5000,
Traits: NewConeflowerTraits(),
Unlocked: false,
})
herbarium.Add("ajuga", FlowerDescriptor{
Name: "Ajuga",
Description: "A flower that is resitant to cold climates and spreads very easily.",
IconTemplate: "flower-ajuga-%s",
BuyPrice: 100000,
SellPrice: 10000,
Traits: NewAjugaTraits(),
Unlocked: false,
})
return &Game{
Speed: GameSpeedNormal,
Balance: 100,

View File

@ -170,9 +170,10 @@ func (r *terrainRenderer) Render(ctx *Context) {
toItemTexture := func(x, y int32) *Texture {
variant := r.terrain.Variant.Value(x, y)
_, ok := r.terrain.Flowers[Pt(x, y)]
flower, ok := r.terrain.Flowers[Pt(x, y)]
if ok {
return variantToTexture("flower-anemone-%d", variant)
desc, _ := r.game.Herbarium.Find(flower.ID)
return ctx.Textures.Texture(desc.IconTemplate.Variant(variantToInt(variant)))
}
temp := r.terrain.Temp.Value(x, y)
humid := r.terrain.Humid.Value(x, y)