Wrote an update
This commit is contained in:
@@ -15,3 +15,4 @@ Check back often for more information! In the mean time, here are my social medi
|
||||
* https://discord.gg/FQmz8TN
|
||||
* https://www.patreon.com/krgamestudios
|
||||
* https://github.com/KRGameStudios
|
||||
|
||||
|
||||
@@ -8,4 +8,5 @@ I've also implemented a logging system, so that if any errors occur, I'll be abl
|
||||
|
||||
Finally, I've also fixed the email bug - before, it could take over a minute for the verification email to arrive. Now it should arrive instantly. Interestingly, that wasn't a problem with my code, but rather how the server was configured. I'll have to keep that in mind if I ever migrate this project.
|
||||
|
||||
OK, I'll keep working, since it's still early in the day.
|
||||
OK, I'll keep working, since it's still early in the day.
|
||||
|
||||
|
||||
@@ -5,3 +5,4 @@ _26 May 2019_
|
||||
I keep wanting to start working on the combat, but I keep getting feedback about the site as a whole. I'm happy to receive it, of course, it just means I'll have to work even harder!
|
||||
|
||||
I've removed the forms to the right, and moved them into their own pages. This should make it cleaner to signup and login. I've also added a blurb to the main page, and tweaked the styling so it's not simply a wall of text. Hopefully, it looks better - I really can't tell, since I'm too close to the project.
|
||||
|
||||
|
||||
@@ -6,4 +6,5 @@ I neglect my sleeping pattern...
|
||||
|
||||
I'm testing code minimization and code splitting to deal with the slow load times reported by multiple people. The main cause is that this website is hosted in Australia, but I'm trying to minimize the impact with various techniques before progressing.
|
||||
|
||||
I didn't want to spend the night on something incredibly demanding like the attack button, so instead I spent the night on something incredibly demanding like optimisation. -_-
|
||||
I didn't want to spend the night on something incredibly demanding like the attack button, so instead I spent the night on something incredibly demanding like optimisation. -_-
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
Button, Button, Who's Got The Button?
|
||||
---
|
||||
_29 May 2019_
|
||||
|
||||
OK, the attack button is now visible on other people's profiles. This isn't active yet because I've only been working on the client code - next up is the server and game code.
|
||||
|
||||
The plan is this:
|
||||
|
||||
* You can attack another player using your soldiers (it doesn't work without soldiers).
|
||||
* Doing so takes time, up to 10 seconds for every soldier you have.
|
||||
* Combat takes place at the end of the time delay, at which point you can attack people again (after reloading the page).
|
||||
* While attacking, you are undefended.
|
||||
* While undefended, your recruits act as combatants, otherwise your soldiers do.
|
||||
* The chance of success is determined by the ratio of each side's combatant strength.
|
||||
* Recruits have a strength equal to 0.25 times that of a soldier.
|
||||
* On a success, you steal 10% of the target's gold. On a failure, you steal 2% of the target's gold.
|
||||
* The attacking force will lose a percentage, rounded down, of their units - 5% on a success, 10% on a failure.
|
||||
|
||||
All of these numbers can be adjusted later, but this is the initial gameplan for combat.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//environment variables
|
||||
require('dotenv').config();
|
||||
|
||||
//utilities
|
||||
let { log } = require('../common/utilities.js');
|
||||
|
||||
const attackRequest = (connection) => (req, res) => {
|
||||
res.status(400).write(log('Not yet implemented'));
|
||||
res.end();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
attackRequest: attackRequest
|
||||
}
|
||||
+3
-1
@@ -38,9 +38,11 @@ app.post('/recruitrequest', profiles.recruitRequest(connection));
|
||||
app.post('/trainrequest', profiles.trainRequest(connection));
|
||||
app.post('/untrainrequest', profiles.untrainRequest(connection));
|
||||
app.post('/ladderrequest', profiles.ladderRequest(connection));
|
||||
app.post('/attackrequest', profiles.attackRequest(connection));
|
||||
profiles.runGoldTick(connection);
|
||||
|
||||
let combat = require('./combat.js');
|
||||
app.post('/attackrequest', combat.attackRequest(connection));
|
||||
|
||||
//static directories
|
||||
app.use('/styles', express.static(path.resolve(__dirname + '/../public/styles')) );
|
||||
app.use('/img', express.static(path.resolve(__dirname + '/../public/img')) );
|
||||
|
||||
@@ -366,11 +366,6 @@ const ladderRequest = (connection) => (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
const attackRequest = (connection) => (req, res) => {
|
||||
res.status(400).write(log('Not yet implemented'));
|
||||
res.end();
|
||||
}
|
||||
|
||||
const runGoldTick = (connection) => {
|
||||
let goldTickJob = new CronJob('0 */30 * * * *', () => {
|
||||
let query = 'UPDATE profiles SET gold = gold + recruits;';
|
||||
@@ -391,6 +386,5 @@ module.exports = {
|
||||
trainRequest: trainRequest,
|
||||
untrainRequest: untrainRequest,
|
||||
ladderRequest: ladderRequest,
|
||||
attackRequest: attackRequest,
|
||||
runGoldTick: runGoldTick
|
||||
}
|
||||
Reference in New Issue
Block a user