-
Notifications
You must be signed in to change notification settings - Fork 1
Effektsystem #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Effektsystem #17
Conversation
… speed modification.
api/effects.json
Outdated
| [ | ||
| { | ||
| "id": 1, | ||
| "name": "QuickEscape", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Erster, super simpler Effekt. Wird genutzt um Dodos einen kleinen Sprint zu geben, wenn sie geschlagen werden.
| // Parse effects | ||
| var effectsByEvent = &EffectsByEvent{} | ||
| var err error | ||
| if effectsByEvent.WhileCarried, err = effects.MapAndValidateEffects(r, "WhileCarried", i.Effects.WhileCarried); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gibt es eine Variante um das schöner zu lösen statt 3 Zeilen pro Event-Parsing zu haben?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich würde das ganze ein wenig flexibler gestalten, wenn du jedoch deinen fixen struct befüllst kommst du wohl kaum um die Zeilen rum. Ev. könntest to ein bisschen reflect nutzen.
| @@ -1,4 +1,4 @@ | |||
| import {isDefined, removeElement} from "./Utils"; | |||
| import {isDefined, isUndefined, removeElement} from "./Utils"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kannst du ignorieren, das war nur ein Fehler den ich im Frontend gefixt habe
|
Meine Hauptfragen wären:
|
|
uiii, sexy! Ich führ mir das mal zu Gemüte am Wochenende 👍 |
api/_definitions/effects.json
Outdated
| "type": "integer", | ||
| "description": "Number of times this effect can be applied simultaneously to the same entity. Omitting this property means no limit to the stack size.", | ||
| "minimum": 1, | ||
| "default": "infinity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sollte nicht 0 als 'infinity' gelten? typisierte Sprachen haben für int kaum ein infinity definiert ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Da habe ich eine Weile überlegt. Ich habe es so implementiert, dass "Wert nicht definiert im JSON" als nil herumgereicht wird, und dann maxStacks ignoriert wird. Natürlich könnte man das auch als 0 annehmen, aber dann würde der Default mit dem Minimum kollidieren, daher meine Angabe "infinity" (die natürlich nicht als Integer.INFINITY gelöst ist, sondern eben als nil) an den User adressiert, von wegen "wenn du nichts angibt, kann der Effekt beliebig oft stacken"
trichner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cooles Ding!
Ich würde unbedingt das addieren/subtrahieren unterlassen, du hast eine gute Wahrscheinlichkeit dass a * x / x != a da die Operationen im Allgemeinen lossy sind. Ich würde die Effekte für jeden Tick wieder frisch aufaddieren, wenns zu hart ist für die performance liesse sich das dann auch einfach cachen...
Im Allgemeinen scheint mir die momentane Lösung skaliert relativ schlecht, wie du bereits selber gemerkt hast repetiert sich einiges relativ oft.
api/_definitions/effects.json
Outdated
| @@ -0,0 +1,188 @@ | |||
| { | |||
| "$schema": "http://json-schema.org/draft-07/schema#", | |||
| "$id": "https://berryhunter.io/schema/effects.json", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return Inventory{ | ||
| items: make([]*ItemStack, 0, 10), | ||
| cap: DEFAULT_INVENTORY_CAP, | ||
| effectEntity: p, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warum sind effekte teil des inventars?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Cap returns the maximum amount of item slots | ||
| func (i *Inventory) Cap() int { | ||
| return i.cap | ||
| return i.cap + i.effectEntity.EffectStack().Factors().InventoryCap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kannst du das nicht generischer lösen?
| // Parse effects | ||
| var effectsByEvent = &EffectsByEvent{} | ||
| var err error | ||
| if effectsByEvent.WhileCarried, err = effects.MapAndValidateEffects(r, "WhileCarried", i.Effects.WhileCarried); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich würde das ganze ein wenig flexibler gestalten, wenn du jedoch deinen fixen struct befüllst kommst du wohl kaum um die Zeilen rum. Ev. könntest to ein bisschen reflect nutzen.
berryhunterd/sys/state.go
Outdated
| for _, p := range s.players { | ||
|
|
||
| if p.VitalSigns().Health == 0 { | ||
| if p.VitalSigns().Health <= 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warum? Ziemlich sicher sind die VitalSigns gegen over- und underflow geschützt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Da habe ich wohl rumgespielt, um den angesprochenen Bug zu beheben
Es gibt einen weirden Bug, dass das EffectSystem irgendwie dafür sorgt, dass sys.Update und sys.State nicht mehr richtig herum ausgeführt werden. Das führt sichtbar dazu, dass cheat: KILL nicht mehr funktioniert (da der Player leben regeneriert bevor er als tot aus dem Spiel entfernt wird), aber evtl gibt es noch weitere üble Nebenwirkungen. Ich kann mir leider absolut nicht erklären, warum - immerhin zählt das system nur die effekt durations herunter.


Details: https://trello.com/c/HSEQ3wJ5/433-effektsystem