Failed to commit these
This commit is contained in:
+4
-4
@@ -147,16 +147,16 @@ const runCombatTick = (connection) => {
|
||||
|
||||
//determine the spoils and casualties
|
||||
let spoilsGold = Math.floor(results[0].gold * (victor === 'attacker' ? 0.1 : 0.02));
|
||||
let casualtiesVictor = Math.floor((pendingCombat.attackingUnits >= 10 ? pendingCombat.attackingUnits - 10 : 0) * (victor === 'attacker' ? 0.05 : 0.1));
|
||||
let attackerCasualties = Math.floor((pendingCombat.attackingUnits >= 10 ? pendingCombat.attackingUnits - 10 : 0) * (victor === 'attacker' ? 0.05 : 0.1));
|
||||
|
||||
//save the combat
|
||||
let query = 'INSERT INTO pastCombat (eventTime, attackerId, defenderId, attackingUnits, defendingUnits, undefended, victor, spoilsGold, casualtiesVictor) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
connection.query(query, [pendingCombat.eventTime, pendingCombat.attackerId, pendingCombat.defenderId, pendingCombat.attackingUnits, defendingUnits, undefended, victor, spoilsGold, casualtiesVictor], (err) => {
|
||||
let query = 'INSERT INTO pastCombat (eventTime, attackerId, defenderId, attackingUnits, defendingUnits, undefended, victor, spoilsGold, attackerCasualties) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
connection.query(query, [pendingCombat.eventTime, pendingCombat.attackerId, pendingCombat.defenderId, pendingCombat.attackingUnits, defendingUnits, undefended, victor, spoilsGold, attackerCasualties], (err) => {
|
||||
if (err) throw err;
|
||||
|
||||
//update the attacker profile
|
||||
let query = 'UPDATE profiles SET gold = gold + ?, soldiers = soldiers - ? WHERE accountId = ?;';
|
||||
connection.query(query, [spoilsGold, casualtiesVictor, pendingCombat.attackerId], (err) => {
|
||||
connection.query(query, [spoilsGold, attackerCasualties, pendingCombat.attackerId], (err) => {
|
||||
if (err) throw err;
|
||||
|
||||
//update the defender profile
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"Weapons": {
|
||||
"Stick": { "cost": 50, "combatBoost": 0.02, "scientistsRequired": 1, "purchasable": true },
|
||||
"Dagger": { "cost": 75, "combatBoost": 0.03, "scientistsRequired": 2, "purchasable": true },
|
||||
"Sword": { "cost": 100, "combatBoost": 0.04, "scientistsRequired": 3, "purchasable": true },
|
||||
"Longsword": { "cost": 150, "combatBoost": 0.05, "scientistsRequired": 4, "purchasable": true },
|
||||
"Frying Pan": { "cost": 200, "combatBoost": 0.06, "scientistsRequired": 5, "purchasable": true }
|
||||
"Stick": { "cost": 50, "purchasable": true, "saleable": true, "scientistsRequired": 1, "combatBoost": 0.02 },
|
||||
"Dagger": { "cost": 75, "purchasable": true, "saleable": true, "scientistsRequired": 2, "combatBoost": 0.03 },
|
||||
"Sword": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 3, "combatBoost": 0.04 },
|
||||
"Longsword": { "cost": 150, "purchasable": true, "saleable": true, "scientistsRequired": 4, "combatBoost": 0.05 },
|
||||
"Frying Pan": { "cost": 200, "purchasable": true, "saleable": true, "scientistsRequired": 5, "combatBoost": 0.06 }
|
||||
},
|
||||
"Armour": {
|
||||
"Leather": { "cost": 75, "combatBoost": 0.02, "scientistsRequired": 2, "purchasable": true },
|
||||
"Gambeson": { "cost": 100, "combatBoost": 0.03, "scientistsRequired": 3, "purchasable": true },
|
||||
"Chainmail": { "cost": 150, "combatBoost": 0.04, "scientistsRequired": 4, "purchasable": true },
|
||||
"Platemail": { "cost": 200, "combatBoost": 0.05, "scientistsRequired": 5, "purchasable": true }
|
||||
"Leather": { "cost": 75, "purchasable": false, "saleable": true, "scientistsRequired": 2, "combatBoost": 0.02 },
|
||||
"Gambeson": { "cost": 100, "purchasable": false, "saleable": true, "scientistsRequired": 3, "combatBoost": 0.03 },
|
||||
"Chainmail": { "cost": 150, "purchasable": false, "saleable": true, "scientistsRequired": 4, "combatBoost": 0.04 },
|
||||
"Platemail": { "cost": 200, "purchasable": false, "saleable": true, "scientistsRequired": 5, "combatBoost": 0.05 }
|
||||
},
|
||||
"Consumables": {
|
||||
"Potion": { "cost": 100, "combatBoost": 0.04, "scientistsRequired": 1, "purchasable": true }
|
||||
"Potion": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 1, "combatBoost": 0.04 }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user