Compare commits
No commits in common. "933796bb4a343ba8804c4dd82683bc3352c67229" and "387e980f5dd058f524705ef8fb26cdf5525050c0" have entirely different histories.
933796bb4a
...
387e980f5d
@ -8,7 +8,6 @@
|
||||
|
||||
|
||||
let numberOfUnits = 0;
|
||||
let repeatMission = false;
|
||||
$: maximumUnits = getRemainingUnitCount($village, 'soldier');
|
||||
$: if (numberOfUnits > maximumUnits) {
|
||||
numberOfUnits = maximumUnits || 0;
|
||||
@ -21,12 +20,7 @@
|
||||
|
||||
|
||||
function pillage() {
|
||||
moves.pillage(region.state.index, numberOfUnits, repeatMission);
|
||||
}
|
||||
|
||||
|
||||
function toggleMissionRepeat() {
|
||||
moves.toggleMissionRepeat(region.state.index);
|
||||
moves.pillage(region.state.index, numberOfUnits);
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -40,10 +34,6 @@
|
||||
<div>
|
||||
<p>{ region.state.mission.unitCount } soldiers are on a mission here.</p>
|
||||
<p>Remaining: { Math.ceil(region.state.mission.remainingTime / 1000) }</p>
|
||||
<label>
|
||||
<input type="checkbox" checked={ region.state.mission.repeat } on:change={ toggleMissionRepeat }>
|
||||
<span title="Send the same troops again when they come back">Repeat</span>
|
||||
</label>
|
||||
</div>
|
||||
{ :else }
|
||||
<div>
|
||||
@ -54,13 +44,15 @@
|
||||
max={ maximumUnits }
|
||||
bind:value={ numberOfUnits }
|
||||
/>
|
||||
{ numberOfUnits }
|
||||
<input
|
||||
type="number"
|
||||
name="units"
|
||||
min="0"
|
||||
max={ maximumUnits }
|
||||
bind:value={ numberOfUnits }
|
||||
/>
|
||||
<button on:click={ setMaxUnits }>↑</button>
|
||||
<button on:click={ pillage } disabled={ numberOfUnits === 0 }>Pillage</button>
|
||||
<label>
|
||||
<input type="checkbox" bind:value={ repeatMission }>
|
||||
<span title="Send the same troops again when they come back">Repeat</span>
|
||||
</label>
|
||||
</div>
|
||||
{ /if }
|
||||
</div>
|
||||
|
@ -25,6 +25,5 @@
|
||||
.region {
|
||||
border: 1px solid white;
|
||||
padding: 1em;
|
||||
width: 40%;
|
||||
}
|
||||
</style>
|
||||
|
@ -5,7 +5,7 @@ import type { VillageState } from "../village";
|
||||
|
||||
|
||||
function getStandardTimeToBuild(level: number) {
|
||||
return Math.round(Math.pow(level, 1 / 0.8) + 2);
|
||||
return Math.round(Math.pow(level, 1 / 1.2) + 1);
|
||||
}
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ export default [
|
||||
{
|
||||
type: 'palace',
|
||||
name: 'Palace',
|
||||
maxLevel: 10,
|
||||
maxLevel: 20,
|
||||
unique: true,
|
||||
requiredTownhallLevel: 10,
|
||||
cost: (level: number) => {
|
||||
@ -345,7 +345,7 @@ export default [
|
||||
},
|
||||
triggers: {
|
||||
onLevelUp: (V: VillageState, self: BuildingType) => {
|
||||
if (self.level === 5 || self.level === 10) {
|
||||
if (self.level === 10 || self.level === 20) {
|
||||
// Create a new hero.
|
||||
V.heroes.push(createHero());
|
||||
}
|
||||
|
@ -18,13 +18,6 @@ export function resolveMission(V: VillageState, region: RegionType) {
|
||||
default:
|
||||
throw new Error(`Unknown mission type: "${ mission.type }"`);
|
||||
}
|
||||
|
||||
if (mission.repeat) {
|
||||
mission.remainingTime = region.distance * 10 * 1000;
|
||||
}
|
||||
else {
|
||||
delete region.state.mission;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,4 +30,5 @@ function resolvePillageOasis(V: VillageState, region: OasisType) {
|
||||
const unit = getUnitSource('soldier');
|
||||
|
||||
V.resources[region.resource] += mission.unitCount * unit.behavior.caryingCapacity;
|
||||
delete region.state.mission;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import build from './build';
|
||||
import pillage from './pillage';
|
||||
import recruitUnits from './recruitUnits';
|
||||
import startQuest from './startQuest';
|
||||
import toggleMissionRepeat from './toggleMissionRepeat';
|
||||
import upgradeBuilding from './upgradeBuilding';
|
||||
|
||||
|
||||
@ -37,5 +36,4 @@ export default {
|
||||
pillage: makeMove(pillage),
|
||||
recruitUnits: makeMove(recruitUnits),
|
||||
startQuest: makeMove(startQuest),
|
||||
toggleMissionRepeat: makeMove(toggleMissionRepeat),
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ import { getRemainingUnitCount } from "../utils";
|
||||
import type { VillageState } from "../village";
|
||||
|
||||
|
||||
export default function pillage(V: VillageState, regionIndex: number, soldiersCount: number, repeat: boolean) {
|
||||
export default function pillage(V: VillageState, regionIndex: number, soldiersCount: number) {
|
||||
if (soldiersCount > getRemainingUnitCount(V, 'soldier')) {
|
||||
return false;
|
||||
}
|
||||
@ -18,7 +18,6 @@ export default function pillage(V: VillageState, regionIndex: number, soldiersCo
|
||||
unitType: 'soldier',
|
||||
unitCount: soldiersCount,
|
||||
remainingTime: region.distance * 10 * 1000,
|
||||
repeat,
|
||||
};
|
||||
|
||||
return true;
|
||||
|
@ -1,14 +0,0 @@
|
||||
import type { VillageState } from "../village";
|
||||
|
||||
|
||||
export default function toggleMissionRepeat(V: VillageState, regionIndex: number) {
|
||||
const region = V.worldmap[regionIndex];
|
||||
|
||||
if (!region.state.mission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
region.state.mission.repeat = !region.state.mission.repeat;
|
||||
|
||||
return true;
|
||||
}
|
@ -78,7 +78,6 @@ export interface MissionType {
|
||||
unitType: string;
|
||||
unitCount: number;
|
||||
remainingTime: number;
|
||||
repeat: boolean;
|
||||
}
|
||||
|
||||
interface BaseRegionType {
|
||||
|
Loading…
Reference in New Issue
Block a user