-
Notifications
You must be signed in to change notification settings - Fork 4
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
Minor fixes to CombatController #1
base: master
Are you sure you want to change the base?
Conversation
…owned count was compared to team count combat would end.
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.
Overall good! A small formatting nitpick. Also I'm going to test this out tonight but I trust that it works.
} | ||
else | ||
//put downed players at 1 HP | ||
{ |
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.
JS Formatting: I would put the brace immediately after else
, like else {
, then the 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.
Modified to match the recommended format(5c344ea)
} | ||
B.sayAt(p.character, '-> The battle is over.'); | ||
if (!p.character.isNpc) { | ||
p.character.queueCommand({ |
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.
Interesting approach here. Why not just emit the combat end event directly?
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.
Ah, I see this must be the fix for the extra combat messages. I'd put a comment here explaining that. Seems like an odd side effect but glad you figured this one out.
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.
Note that this occurs on a ranvier using the standard bundles with turn-combat added. It might not be occurring on a ranvier using the full trpg-skeleton
The Bugfix for the attack command(ee9bd7b) will not work without a core change to Character.isInCombat() It shouldn't break anything as for trpg-skeleton that method will always return false, meaning the existing logic will happen. |
My workaround for that was to add a method, |
command: state => (args, player) => { | ||
const target = [...player.room.npcs][0]; | ||
const controller = new CombatController(state); | ||
//TODO: Add pvp flag to this |
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.
For the sake of keeping PRs small I would consider adding this fix as a separate PR particularly as it has several TODOs. Smaller PRs mean a higher chance for each individual one to get merged in sooner than later.
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.
Agreed, I just found another bug with it, so I'll back this one out of the PR
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.
These changes work great on my end. Good catch with adding this._teamCount[team]++;
to addParticipant
because otherwise those counts stay at 0. Removing Broadcast.prompt(p.character);
gets rid of that duplicate prompt after a battle.
I'm not sure I understand why you're queuing a player emit in the command queue, however. combatEnd
actually does nothing at the moment, but even if it did it wouldn't belong in the command queue. Why not fire it immediately?
Hiya, It's to do with the order of commands. Calling it directly caused anything in combatEnd to occur before all the endCombat() was complete. This seems to be the wrong way round to me. |
I agree with that idea. The issue with this implementation, however, is the player events for You could solve this by adding commandQueued: state => function (commandIndex) {
const command = this.commandQueue.queue[commandIndex];
const ttr = this.commandQueue.getTimeTilRun(commandIndex);
},
updateTick: state => function () {
if (this.commandQueue.hasPending && this.commandQueue.lagRemaining <= 0) {
B.sayAt(this);
this.commandQueue.execute();
B.prompt(this);
}
} And if you're going to be editing the player events, you might as well also add a handler for combatEnd: state => function () {
Broadcast.sayAt(this, 'You leave combat.')
} |
Fixes for:
-teamCount is never incremented
-Flee causes enemy mobs to be removed
-Combat Messages displaying after the look command from combatEnd