Comments (3)
I'm aware of this one, no open issue for it already though afaik. I was thinking that this wasn't easily fixable at the time.
from ancientbeast.
I was thinking that this wasn't easily fixable at the time.
The whole thing is in need of a rethink/refactor, I think. To give you an idea:
The Creature Grid / Dash isn't isolated, either as a module or otherwise. It's a collection of attributes and methods in interface.js
and there's a fair amount of leakage. E.g., the Dash system works by setting an attribute on interface
that's picked up during button presses, to then be sent to the Priest's materialize
method.
And here's how the priest ability says "choose a creature to summon":
// Ask the creature to summon
G.UI.materializeToggled = true;
G.UI.toggleDash('randomize');
... so it's got to muck around with UI
internals, despite not having a direct reference to UI
. And then it doesn't even get a direct reference back. Some part of interface
has to in turn muck around in the ability like so:
activeCreature.abilities[3].materialize(this.lastViewedCreature);
Not pointing fingers, but just to walk you through what's going on: here are the assumptions behind and code brittleness introduced with just that single line:
activeCreature
has to have a field calledabilities
.- That field has to be an array that has at least 4 slots.
- The
3
slot in the array has to have amaterialize
method.
And that doesn't include how it is that interface
decides that this activeCreature
is a creature who can summon.
The whole thing could be a lot less brittle and a lot less complicated if it were called like this:
// Ask the creature to summon
G.chooseCreatureTypeFrom(this.creature.getSummonableCreatureTypes()).then(type => this.materialize(type));
- No special interface code to figure out if the current creature can summon and is currently summoning.
- No knowledge of interface at all in the ability.
from ancientbeast.
I have a coded solution. I'll wait on feedback from this discussion before finalizing and opening a PR.
from ancientbeast.
Related Issues (20)
- coinimp.js? miner.html? HOT 4
- Husky lint-staged not running [bounty: 10 XTR] HOT 4
- Node.js server fails to start HOT 1
- missing ability trap sprites [bounty: 2 XTR] HOT 1
- drops not centered [bounty: 1 XTR] HOT 1
- OpenCollective widget within dash [bounty: 3 XTR] HOT 3
- star-history.com advertising HOT 1
- Abolished Fiery Touch throws error when used facing left HOT 1
- bouncing indicator [bounty: 2 XTR] HOT 11
- Hint `cssClass`
- Hex hover bug - Hexgrid + hotkeys HOT 1
- Pathfinding doesn't use h(n) HOT 1
- only one notification for Poisonous Vine [bounty: 2 XTR] HOT 5
- `creature.adjacentHexes` returns counter-clockwise hexes when `clockwise=true`
- Creature Dash arrow keys error: "stats is undefined" HOT 11
- can't enable ability upgrades from the start [bounty: 3 XTR] HOT 2
- vertical browser tabs overlap UI elements [bounty: 6 XTR] HOT 5
- Firefox warns about OpenCollective embed HOT 2
- `creature.flipped` is `undefined` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ancientbeast.