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