Skip to content

Commit

Permalink
Bunch of fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vollch committed Jun 30, 2022
1 parent 8fc0ff9 commit fea5621
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 188 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
evolve/* -diff
wiki/* -diff
147 changes: 86 additions & 61 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ export const actions = {
cost: {
DNA(){ return 255; }
},
effect(){ return global.city.biome === 'hellscape' && global.race.universe !== 'evil' ? `<div>${loc('evo_omnivore_effect')}</div><div class="has-text-special">${loc('evo_warn_unwise')}</div>` : loc('evo_herbivore_effect'); },
effect(){ return global.city.biome === 'hellscape' && global.race.universe !== 'evil' ? `<div>${loc('evo_omnivore_effect')}</div><div class="has-text-special">${loc('evo_warn_unwise')}</div>` : loc('evo_omnivore_effect'); },
action(){
if (payCosts($(this)[0])){
global.evolution['omnivore'].count++;
Expand Down Expand Up @@ -2251,59 +2251,7 @@ export const actions = {
},
touchlabel: loc(`kill`)
},
horseshoe: {
id: 'city-horseshoe',
title(){ return loc(global.race['sludge'] ? 'city_beaker' : 'city_horseshoe'); },
desc(){ return loc(global.race['sludge'] ? 'city_beaker_desc' : `city_horseshoe_desc`); },
category: 'outskirts',
reqs: { primitive: 3 },
trait: ['hooved'],
not_trait: ['cataclysm'],
inflation: false,
cost: {
Lumber(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
let active = !global.race['kindling_kindred'] && !global.race['smoldering']
&& (!global.resource.Copper.display || shoes <= 12) ? true : false;
return active ? (shoes > 12 ? 25 : 5) * (shoes <= 5 ? 1 : shoes - 4) : 0;
},
Copper(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
let lum = (global.race['kindling_kindred'] || global.race['smoldering']) ? false : true;
let active = (!lum || (lum && shoes > 12 && global.resource.Copper.display))
&& (!global.resource.Iron.display || shoes <= 75) ? true : false;
return active ? (shoes > 75 ? 20 : 5) * (shoes <= 12 ? 1 : shoes - 11) : 0;
},
Iron(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Iron.display && shoes > 75 && (!global.resource.Steel.display || shoes <= 150) ? (shoes <= 150 ? 12 : 28) * shoes : 0;
},
Steel(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Steel.display && shoes > 150 && (!global.resource.Adamantite.display || shoes <= 500) ? (shoes <= 500 ? 40 : 100) * shoes : 0;
},
Adamantite(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Adamantite.display && shoes > 500 && (!global.resource.Orichalcum.display || shoes <= 5000) ? (shoes <= 5000 ? 5 : 25) * shoes : 0;
},
Orichalcum(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Orichalcum.display && shoes > 5000 ? 25 * shoes - 120000 : 0;
}
},
action(n){
let keyMult = n || keyMultiplier();
let shoed = false;
for (var i=0; i<keyMult; i++){
if (global.resource.Horseshoe.display && payCosts($(this)[0])){
global.resource.Horseshoe.amount++;
global.race.shoecnt++;
shoed = true;
}
}
return shoed;
},
},
horseshoe: buildTemplate(`horseshoe`,'city'),
bonfire: buildTemplate(`bonfire`,'city'),
firework: buildTemplate(`firework`,'city'),
slave_market: {
Expand Down Expand Up @@ -5042,6 +4990,69 @@ export function buildTemplate(key, region){
flair: loc(`city_nanite_factory_flair`)
};

if (region === 'space'){
action.trait.push('cataclysm');
}
else {
action['not_trait'] = ['cataclysm'];
}
return action;
}
case 'horseshoe':
{
let id = region === 'space' ? 'space-horseshoe' : 'city-horseshoe';
let action = {
id: id,
title(){ return loc(global.race['sludge'] ? 'city_beaker' : 'city_horseshoe'); },
desc(){ return loc(global.race['sludge'] ? 'city_beaker_desc' : 'city_horseshoe_desc'); },
category: 'outskirts',
reqs: { primitive: 3 },
trait: ['hooved'],
cost: {
Lumber(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
let active = !global.race['kindling_kindred'] && !global.race['smoldering']
&& (!global.resource.Copper.display || shoes <= 12) ? true : false;
return active ? (shoes > 12 ? 25 : 5) * (shoes <= 5 ? 1 : shoes - 4) : 0;
},
Copper(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
let lum = (global.race['kindling_kindred'] || global.race['smoldering']) ? false : true;
let active = (!lum || (lum && shoes > 12 && global.resource.Copper.display))
&& (!global.resource.Iron.display || shoes <= 75) ? true : false;
return active ? (shoes > 75 ? 20 : 5) * (shoes <= 12 ? 1 : shoes - 11) : 0;
},
Iron(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Iron.display && shoes > 75 && (!global.resource.Steel.display || shoes <= 150) ? (shoes <= 150 ? 12 : 28) * shoes : 0;
},
Steel(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Steel.display && shoes > 150 && (!global.resource.Adamantite.display || shoes <= 500) ? (shoes <= 500 ? 40 : 100) * shoes : 0;
},
Adamantite(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Adamantite.display && shoes > 500 && (!global.resource.Orichalcum.display || shoes <= 5000) ? (shoes <= 5000 ? 5 : 25) * shoes : 0;
},
Orichalcum(offset){
let shoes = (global.race['shoecnt'] || 0) + (offset || 0);
return global.resource.Orichalcum.display && shoes > 5000 ? 25 * shoes - 120000 : 0;
}
},
action(n){
let keyMult = n || keyMultiplier();
let shoed = false;
for (var i=0; i<keyMult; i++){
if (global.resource.Horseshoe.display && payCosts($(this)[0])){
global.resource.Horseshoe.amount++;
global.race.shoecnt++;
shoed = true;
}
}
return shoed;
}
};

if (region === 'space'){
action.trait.push('cataclysm');
}
Expand Down Expand Up @@ -5452,14 +5463,16 @@ export function checkCityRequirements(action){
return isMet;
}

export function checkTechRequirements(tech){
let isMet = true;

function checkTechPath(tech){
let path = global.race['truepath'] ? 'truepath' : 'standard';
if ((!techPath[path].includes(actions.tech[tech].era) && !actions.tech[tech].hasOwnProperty('path')) || (actions.tech[tech].hasOwnProperty('path') && !actions.tech[tech].path.includes(path))){
return false;
}
return true;
}

function checkTechRequirements(tech){
let isMet = true;
Object.keys(actions.tech[tech].reqs).forEach(function (req){
if (!global.tech[req] || global.tech[req] < actions.tech[tech].reqs[req]){
isMet = false;
Expand Down Expand Up @@ -5649,6 +5662,9 @@ export function drawTech(){
};

Object.keys(actions.tech).forEach(function (tech_name){
if (!checkTechPath(tech_name)){
return;
}
removeAction(actions.tech[tech_name].id);

let isOld = checkOldTech(tech_name);
Expand Down Expand Up @@ -7715,13 +7731,19 @@ function aiStart(){
global.resource.Containers.display = true;

if (!global.race['kindling_kindred'] && !global.race['smoldering']){
global.tech['axe'] = 3;
global.tech['saw'] = 2;
if (global.race['evil']){
global.tech['reclaimer'] = 3;
global.city['graveyard'] = { count: 1 };
}
else {
global.tech['axe'] = 3;
global.tech['saw'] = 2;
global.city['lumber_yard'] = { count: 1 };
global.city['sawmill'] = { count: 0, on: 0 };
}
global.resource.Lumber.display = true;
global.resource.Plywood.display = true;
global.civic.lumberjack.display = true;
global.city['lumber_yard'] = { count: 1 };
global.city['sawmill'] = { count: 0, on: 0 };
}
if (global.race['smoldering']){
global.resource.Chrysotile.display = true;
Expand Down Expand Up @@ -8004,6 +8026,9 @@ function cataclysm(){
global.city['power'] = 0;
global.city['powered'] = true;

if (global.race['artifical']){
global.city['transmitter'] = { count: 0, on: 0 };
}
global.city['factory'] = { count: 0, on: 0, Lux: 0, Furs: 0, Alloy: 0, Polymer: 1, Nano: 0, Stanene: 0 };
global.city['foundry'] = { count: 0, crafting: 0, Plywood: 0, Brick: 0, Bronze: 0, Wrought_Iron: 0, Sheet_Metal: 0, Mythril: 0, Aerogel: 0, Nanoweave: 0, Scarletite: 0, Quantium: 0 };
global.city['smelter'] = { count: 0, cap: 2, Wood: 0, Coal: 0, Oil: 2, Star: 0, StarCap: 0, Inferno: 0, Iron: 1, Steel: 1, Iridium: 0 };
Expand Down
3 changes: 1 addition & 2 deletions src/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { global, breakdown } from './vars.js';
import { deepClone, adjustCosts, messageQueue } from './functions.js';
import { races, traits } from './races.js';
import { craftCost, tradeRatio, atomic_mass, tradeBuyPrice, tradeSellPrice } from './resources.js';
import { actions, checkTechRequirements, checkAffordable } from './actions.js';
import { actions, checkAffordable } from './actions.js';
import { fuel_adjust, int_fuel_adjust } from './space.js';
import { f_rate } from './industry.js';
import { armyRating } from './civics.js';
Expand All @@ -19,7 +19,6 @@ export function enableDebug(){
craftCost: deepClone(craftCost()),
atomic_mass: deepClone(atomic_mass),
f_rate: deepClone(f_rate),
checkTechRequirements: deepClone(checkTechRequirements),
checkAffordable: deepClone(checkAffordable),
adjustCosts: deepClone(adjustCosts),
armyRating: deepClone(armyRating),
Expand Down
4 changes: 4 additions & 0 deletions src/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,7 @@ const valAdjust = {
hivemind: true,
imitation: true,
elusive: true,
chameleon: true,
blood_thirst: true,
selenophobia: true,
hooved: true,
Expand All @@ -2408,6 +2409,9 @@ function getTraitVals(trait,rank){
else if (trait === 'elusive') {
vals = [Math.round(((1/30)/(1/(30+vals[0]))-1)*100)];
}
else if (trait === 'chameleon') {
vals = [vals[0], Math.round(((1/30)/(1/(30+vals[1]))-1)*100)];
}
else if (trait === 'blood_thirst') {
vals = [Math.ceil(Math.log2(vals[0]))];
}
Expand Down
6 changes: 3 additions & 3 deletions src/governor.js
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,8 @@ export const gov_tasks = {
}
}
},
asssemble: { // Asssemble Citizens
name: loc(`gov_task_asssemble`),
assemble: { // Assemble Citizens
name: loc(`gov_task_assemble`),
req(){
return global.race['artifical'] ? true : false;
},
Expand Down Expand Up @@ -994,7 +994,7 @@ export const gov_tasks = {
}
});
if (global.resource[res].amount > amount && (global.resource[res].diff >= amount || global.resource[res].amount + global.resource[res].diff >= global.resource[res].max) ){
actions.city.horseshoe.action();
actions.city.horseshoe.action(1);
}
}
}
Expand Down
33 changes: 11 additions & 22 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,18 @@ export function mainVue(){
}
},
restoreGame(){
if (global.settings.restoreCheck){
let restore_data = save.getItem('evolveBak') || false;
this.$buefy.dialog.confirm({
title: loc('restore'),
message: loc('restore_warning'),
ariaModal: true,
confirmText: loc('restore'),
onConfirm() {
if (restore_data){
importGame(restore_data,true);
}
else {
global.settings.restoreCheck = false;
}
},
onCancel(){
global.settings.restoreCheck = false;
let restore_data = save.getItem('evolveBak') || false;
this.$buefy.dialog.confirm({
title: loc('restore'),
message: loc('restore_warning'),
ariaModal: true,
confirmText: loc('restore'),
onConfirm() {
if (restore_data){
importGame(restore_data,true);
}
});
}
else {
global.settings.restoreCheck = true;
}
}
});
},
lChange(locale){
global.settings.locale = locale;
Expand Down
6 changes: 2 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,7 @@ function fastLoop(){

let delta = generated - consume - tourism - spaceport - starport - starbase - space_station - space_marines - embassy - zoo;

food_bd[global.race['artifical'] ? loc('space_red_signal_tower_title') : loc('space_red_biodome_title')] = biodome + 'v';
food_bd[actions.space.spc_red.biodome.title()] = biodome + 'v';
if (biodome > 0){
food_bd[`ᄂ${loc('space_red_ziggurat_title')}`] = ((zigVal - 1) * 100) + '%';
}
Expand Down Expand Up @@ -4301,7 +4301,7 @@ function fastLoop(){
let lumber_bd = {};
let lumber = support_on['biodome'] * global.civic.colonist.workers * production('biodome','lumber');

lumber_bd[loc('space_red_biodome_title')] = lumber + 'v';
lumber_bd[actions.space.spc_red.biodome.title()] = lumber + 'v';
if (lumber > 0){
lumber_bd[`ᄂ${loc('space_red_ziggurat_title')}`] = ((zigVal - 1) * 100) + '%';
}
Expand Down Expand Up @@ -9379,8 +9379,6 @@ function longLoop(){
delete global.tech['santa'];
}

global.settings.restoreCheck = false;

if (eventActive('fool')){
if (!$(`body`).hasClass('fool')){
$(`body`).addClass('fool');
Expand Down
6 changes: 2 additions & 4 deletions src/portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2295,10 +2295,8 @@ export function bloodwar(){
}
}

let odds = 30;
if (global.race['chameleon'] || global.race['elusive']){
odds += global.race['elusive'] ? traits.elusive.vars()[0] : (global.race['chameleon'] ? traits.chameleon.vars()[0] : 20);
}
let odds = 30 + Math.max(global.race['chameleon'] ? traits.chameleon.vars()[1] : 0,
global.race['elusive'] ? traits.elusive.vars()[0] : 0);
if (Math.rand(0,odds) === 0){
dead += casualties(Math.round(demons * (1 + Math.random() * 3)),0,true);
let remain = demons - Math.round(pat_rating / 2);
Expand Down
11 changes: 6 additions & 5 deletions src/races.js
Original file line number Diff line number Diff line change
Expand Up @@ -1587,17 +1587,18 @@ export const traits = {
type: 'major',
val: 6,
vars(r){
// [Combat Rating Bonus, Ambush Avoid]
switch (r || global.race.chameleon || 1){
case 0.25:
return [5];
return [5,10];
case 0.5:
return [10];
return [10,15];
case 1:
return [20];
return [20,20];
case 2:
return [25];
return [25,25];
case 3:
return [30];
return [30,30];
}
},
},
Expand Down
Loading

0 comments on commit fea5621

Please sign in to comment.