ndouglas / downdelving-old

An experimental roguelike written in Rust.
The Unlicense
1 stars 0 forks source link

Refactor WantsTo<Verb> components. #42

Open ndouglas opened 2 years ago

ndouglas commented 2 years ago

Story

The WantsToMelee, WantsToFlee, etc components are great. But I think they would be better grouped together under a single component (WantsToVerb?), with each value parameterized.

For instance, something like this:

pub enum ThingsToTouch {
  TheSky,
  TheBooty,
}

pub enum ThingsToFlee {
  HotThings,
  ColdThings,
  Water,
  Entity { Entity },
}

pub enum Desires {
  ToTouch { thing: ThingsToTouch, amount: i32 },
  ToFlee { thing: ThingsToFlee, amount: i32 },
  ToEat { thing: ThingsToEat, amount: i32 },
  ToSelfImmolate { amount: i32 },
}

That sort of thing. So we could conceivably model some fairly complex desires and some fairly simple ones, and then compare them with the amount.

It would be interesting to think about how to model e.g. someone who is hungry and hates carrots. At some point, they'll eat anything, even carrots, to keep from starving. But before then, they're going to be fixated on turnips.

Acceptance Criteria

Implementation Notes