Mercerenies / a-turtles-troll

Random Minecraft shenanigans
GNU General Public License v3.0
4 stars 2 forks source link

Unify rewards #147

Open Mercerenies opened 7 months ago

Mercerenies commented 7 months ago

We have a lot of different reward or effect classes right now, whose methods all boil down to some variant of

interface WhateverEffect {
  fun applyToPlayer(player: Player, context: SomeClass): Unit
}

Among these, we have

These three should, at minimum, inherit from a common super-interface.

As a stretch goal, we also have BowserReward, which is different in that it rewards all players (with one player getting a special reward). It's not as similar to the others, but it's worth mentioning.

Mercerenies commented 7 months ago

The four classes, as they appear now (b68435d):

interface TriviaQuestionReward {
  val name: Component
  fun rewardPlayer(player: Player): Unit
}

interface CookieEffect {
  fun cancelsDefault(): Boolean
  fun onEat(action: CookieEatenAction)
}

interface BowserReward {
  fun getMainRewardText(): Component
  fun getSpecialRewardText(player: Player): Component
  fun giveMainReward(player: Player): Unit
  fun giveSpecialReward(player: Player): Unit
}

interface CakeEffect {
  fun cancelsDefault(): Boolean
  fun onEat(loc: Location, player: Player)
}
Mercerenies commented 6 months ago

Doctor Dances also has a reward interface, and so does Prisoner's Dilemma