From 0d18bb4f8386340d0d8202f280943c4eeb53be3c Mon Sep 17 00:00:00 2001 From: rowan Date: Sun, 1 Dec 2024 21:08:56 -0600 Subject: [PATCH] more colors and typo fixing :3 --- content/blog/a-query-about-game-state/index.md | 4 ++-- static/css/main.css | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/content/blog/a-query-about-game-state/index.md b/content/blog/a-query-about-game-state/index.md index 37712bd..d5d04b9 100644 --- a/content/blog/a-query-about-game-state/index.md +++ b/content/blog/a-query-about-game-state/index.md @@ -35,11 +35,11 @@ class Shield: Armor {} In the above scenario, we have [three layers of inheritance](https://wiki.c2.com/?MaxThreeLayersOfInheritance). We can imagine that `Item` handles behaviors like item management such as being added or removed from an inventory and highly generic item behavior. `Weapon` would then be responsible for an item which is capable of dealing damage at any range. We can expect that the specifics of its attack behavior would be implemented by a subclass. Similarly for `Armor`, this would handle generic damage interactions such as common mitigation or avoidance calculations while leaving specific implementation details to its subclasses. -Seasoned game devs, disciplined object-oriented programmers, and existing ECS developers can likely already see what comes next. A new requirement. +Seasoned game devs, disciplined object-oriented programmers, and existing ECS developers can likely already see what comes next: a new requirement. How do we add a Spiked Shield item -- one which derives the behaviors of `Weapon` and `Armor`? If we were using a language which supports multiple inheritance this could potentially be a nonissue: except that multiple inheritance is often [purposefully missing](https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem) in many languages. We could decide that the item belongs more to one class than the other and just duplicate the missing behavior but these types of decisions often introduce unforeseen complexity: will the damage algorithm need to do a specific type check for `SpikedShield`? What about the equipment screen? And of course, what happens when we need to implement a damaging potion? -Perhaps the most appropriate solution this case would be to forgo the inheritance pattern in favor of [composition](https://en.wikipedia.org/wiki/Composition_over_inheritance). In C#, this could be achieved with `interfaces` and default implementations. +Perhaps the most appropriate solution this case would be to forgo the inheritance pattern in favor of [composition](https://en.wikipedia.org/wiki/Composition_over_inheritance). In C#, this could be achieved with interfaces and default implementations. ```cs interface ICollectable { diff --git a/static/css/main.css b/static/css/main.css index f11acd4..ace1be3 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -35,6 +35,7 @@ --foreground-color: var(--white); --background-color: var(--black); --secondary-background-color: var(--dark-violet); + --code-color: var(--primary-complement-color); --border-color: var(--secondary-color); --header-color: var(--secondary-triad-1-color); @@ -54,6 +55,7 @@ --foreground-color: var(--black); --background-color: var(--white); --secondary-background-color: var(--light-violet); + --code-color: var(--tertiary-triad-1-color); --border-color: var(--tertiary-color); --header-color: var(--tertiary-triad-1-color); @@ -129,6 +131,10 @@ img { max-width: 100%; } +code { + color: var(--code-color); +} + pre, code { font-size: 1rem; padding: 0.5rem;