<div style = "text-align:center;"><h1>Adventurer's Trade</h1>
//In this age of adventure, you are but an ordinary peasant, struggling to make ends meet. In a stroke of bad luck, your father, the sole bread winner of this family, died from a terrific accident whilst he was out working. The news broke your mother and siblings alike.
But there's perhaps a light at the end of the tunnel, for there is hope yet for this misfortunated family, the cause of this accident, a kind elderly rich women had taken pity on this poor household and left a hefty sum as compensation.
With your mother sick in bed, it is up to you to use this money and lead your family towards a better future.//
</div>
[[Start|Main]]
<<link "Credits">> <<run slideWin("Credits")>><</link>>
<<include StoryInit>>
<p class = "info">@@#info;<<include info>>@@</p><p class="inventory">@@#inventory;<<include inventory>>@@</p><p class="shop">@@#shop;<<include shop>>@@</p>
[[Next Day]] <<nobr>><<set _amount = [0,0,0,0]>>
<</nobr>><table style="width:100%; text-align: center">
<tr>
<th>Item</th>
<th>Stock</th>
<th>Price</th>
<th>Sell</th>
</tr>
<tr>
<td>Potion</td>
<td><<=$inventory.Potion.Amount>></td>
<td><<=$inventory.Potion.CurrentValue>></td>
<td><<button "-10">><<sell "potion" 10>><</button>> <<button "-1">><<sell "potion" 1>><</button>></td>
</tr>
<tr>
<td>Knife</td>
<td><<=$inventory.Knife.Amount>></td>
<td><<=$inventory.Knife.CurrentValue>></td>
<td><<button "-10">><<sell "knife" 10>><</button>> <<button "-1">><<sell "knife" 1>><</button>></td>
</tr>
<tr>
<td>Travel Clothes</td>
<td><<=$inventory.Cloth.Amount>></td>
<td><<=$inventory.Cloth.CurrentValue>></td>
<td><<button "-10">><<sell "cloth" 10>><</button>> <<button "-1">><<sell "cloth" 1>><</button>></td>
</tr>
<tr>
<td>Orb of Light</td>
<td><<=$inventory.Orb.Amount>></td>
<td><<=$inventory.Orb.CurrentValue>></td>
<td><<button "-10">><<sell "orb" 10>><</button>> <<button "-1">><<sell "orb" 1>><</button>></td>
</tr>
<tr>
<td>Mana Gem</td>
<td><<=$inventory.Mana.Amount>></td>
<td><<=$inventory.Mana.CurrentValue>></td>
<td><<button "-10">><<sell "mana" 10>><</button>> <<button "-1">><<sell "mana" 1>><</button>></td>
</tr>
</table> <table style="width:100%; text-align: center">
<tr>
<th>Item</th>
<th>Amount</th>
<th>Price</th>
<th>Buy</th>
</tr>
<tr>
<td>Potion</td>
<td><<=$shop.Potion.Amount>></td>
<td><<=$shop.Potion.CurrentValue>></td>
<td><<button "+10">><<buy "potion" 10>><</button>> <<button "+1">><<buy "potion" 1>><</button>></td>
</tr>
<tr>
<td>Knife</td>
<td><<=$shop.Knife.Amount>></td>
<td><<=$shop.Knife.CurrentValue>></td>
<td><<button "+10">><<buy "knife" 10>><</button>> <<button "+1">><<buy "knife" 1>><</button>></td>
</tr>
<tr>
<td>Travel Clothes</td>
<td><<=$shop.Cloth.Amount>></td>
<td><<=$shop.Cloth.CurrentValue>></td>
<td><<button "+10">><<buy "cloth" 10>><</button>> <<button "+1">><<buy "cloth" 1>><</button>></td>
</tr>
<tr>
<td>Orb of Light</td>
<td><<=$shop.Orb.Amount>></td>
<td><<=$shop.Orb.CurrentValue>></td>
<td><<button "+10">><<buy "orb" 10>><</button>> <<button "+1">><<buy "orb" 1>><</button>></td>
</tr>
<tr>
<td>Mana Gem</td>
<td><<=$shop.Mana.Amount>></td>
<td><<=$shop.Mana.CurrentValue>></td>
<td><<button "+10">><<buy "mana" 10>><</button>> <<button "+1">><<buy "mana" 1>><</button>></td>
</tr>
</table> <table style="width:100%; text-align: center"> <tr>
<th><h1>WEEK $week</h1></th>
<th>''Money'': $<<=$money>></th>
<th>''Spending:''$<<=$spend>></th>
<th><<button "change">>
<<popup 'spending' 'Change Spending' >>
<</button>></th>
</tr></table><<widget "sell">>
<<set _number = _args[1]>>
<<switch _args[0]>>
<<case "potion">>
<<set _item = $inventory.Potion.Amount>>
<<set _price = $shop.Potion.CurrentValue * _number>>
<<if _item >= _number>>
<<set _item -= _number>>
<<set $inventory.Potion.Amount = _item>>
<<set $money += _price>>
<</if>>
<<if $inventory.Potion.Amount <= 0>><<set $inventory.Potion.CurrentValue = 0>><</if>>
<<case "knife">> <<set _item = $inventory.Knife.Amount>>
<<set _price = $shop.Knife.CurrentValue * _number>>
<<if _item >= _number>>
<<set _item -= _number>>
<<set $inventory.Knife.Amount = _item>>
<<set $money += _price>>
<</if>>
<<if $inventory.Knife.Amount <= 0>>
<<set $inventory.Knife.CurrentValue = 0>><</if>>
<<case "cloth">> <<set _item = $inventory.Cloth.Amount>>
<<set _price = $shop.Cloth.CurrentValue * _number>>
<<if _item >= _number>>
<<set _item -= _number>>
<<set $inventory.Cloth.Amount = _item>>
<<set $money += _price>>
<</if>>
<<if $inventory.Cloth.Amount <= 0>>
<<set $inventory.Cloth.CurrentValue = 0>><</if>>
<<case "orb">> <<set _item = $inventory.Orb.Amount>>
<<set _price = $shop.Orb.CurrentValue * _number>>
<<if _item >= _number>>
<<set _item -= _number>>
<<set $inventory.Orb.Amount = _item>>
<<set $money += _price>>
<</if>>
<<if $inventory.Orb.Amount <= 0>>
<<set $inventory.Orb.CurrentValue = 0>><</if>>
<<case "mana">> <<set _item = $inventory.Mana.Amount>>
<<set _price = $shop.Mana.CurrentValue * _number>>
<<if _item >= _number>>
<<set _item -= _number>>
<<set $inventory.Mana.Amount = _item>>
<<set $money += _price>>
<</if>>
<<if $inventory.Mana.Amount <= 0>><<set $inventory.Mana.CurrentValue = 0>><</if>>
<</switch>>
<<replace "#inventory">><<include inventory>><</replace>>
<<replace "#info">><<include info>><</replace>>
<</widget>>
<<widget "buy">>
<<set _number = _args[1]>>
<<switch _args[0]>>
<<case "potion">>
<<set _item = $shop.Potion.Amount>>
<<set _price = $shop.Potion.CurrentValue * _number>>
<<if $money >= _price && _item >= _number>>
<<set _average = ($inventory.Potion.Amount * $inventory.Potion.CurrentValue + _price)/($inventory.Potion.Amount + _number)>>
<<set $inventory.Potion.CurrentValue = _average>>
<<set _item += _number>>
<<set $inventory.Potion.Amount += _number>>
<<set $shop.Potion.Amount -= _number>>
<<set $money -= _price>>
<</if>>
<<case "knife">>
<<set _item = $shop.Knife.Amount>>
<<set _price = $shop.Knife.CurrentValue * _number>>
<<if $money >= _price && _item >= _number>>
<<set _average = ($inventory.Knife.Amount * $inventory.Knife.CurrentValue + _price)/($inventory.Knife.Amount + _number)>>
<<set $inventory.Knife.CurrentValue = _average>>
<<set _item += _number>>
<<set $inventory.Knife.Amount += _number>>
<<set $shop.Knife.Amount -= _number>>
<<set $money -= _price>>
<</if>>
<<case "cloth">>
<<set _item = $shop.Cloth.Amount>>
<<set _price = $shop.Cloth.CurrentValue * _number>>
<<if $money >= _price && _item >= _number>>
<<set _average = ($inventory.Cloth.Amount * $inventory.Cloth.CurrentValue + _price)/($inventory.Cloth.Amount + _number)>>
<<set $inventory.Cloth.CurrentValue = _average>>
<<set _item += _number>>
<<set $inventory.Cloth.Amount += _number>>
<<set $shop.Cloth.Amount -= _number>>
<<set $money -= _price>>
<</if>>
<<case "orb">>
<<set _item = $shop.Orb.Amount>>
<<set _price = $shop.Orb.CurrentValue * _number>>
<<if $money >= _price && _item >= _number>>
<<set _average = ($inventory.Orb.Amount * $inventory.Orb.CurrentValue + _price)/($inventory.Orb.Amount + _number)>>
<<set $inventory.Orb.CurrentValue = _average>>
<<set _item += _number>>
<<set $inventory.Orb.Amount += _number>>
<<set $shop.Orb.Amount -= _number>>
<<set $money -= _price>>
<</if>>
<<case "mana">>
<<set _item = $shop.Mana.Amount>>
<<set _price = $shop.Mana.CurrentValue * _number>>
<<if $money >= _price && _item >= _number>>
<<set _average = ($inventory.Mana.Amount * $inventory.Mana.CurrentValue + _price)/($inventory.Mana.Amount + _number)>>
<<set $inventory.Mana.CurrentValue = _average>>
<<set _item += _number>>
<<set $inventory.Mana.Amount += _number>>
<<set $shop.Mana.Amount -= _number>>
<<set $money -= _price>>
<</if>>
<</switch>>
<<replace "#inventory">><<include inventory>><</replace>>
<<replace "#info">><<include info>><</replace>>
<<replace "#shop">><<include shop>><</replace>>
<</widget>>
<<set $money -= $spend>>
<<set $week += 1>>
//random price + stock
<<set $shop.Potion.CurrentValue = random(1, 50)>>
<<set $shop.Knife.CurrentValue = random(10, 150)>>
<<set $shop.Cloth.CurrentValue = random(50, 500)>>
<<set $shop.Orb.CurrentValue = random(100, 1000)>>
<<set $shop.Mana.CurrentValue = random(500, 2000)>>
<<set $shop.Potion.Amount = random(20, 1000)>>
<<set $shop.Knife.Amount = random(10, 500)>>
<<set $shop.Cloth.Amount = random(5, 500)>>
<<set $shop.Orb.Amount = random(1, 50)>>
<<set $shop.Mana.Amount = random(0, 50)>>
//sickness
<<if $money < 30 && $sick != 0>>
<<set $sick += 3>>
<<else>>
<<set $sick = $sick - $spend/10>>
<</if>>
<<if $sick > 90>>
<<set $event.push("Worse")>>
<<elseif $sick < 30>>
<<set $event.push("Heal")>>
<</if>>
<<if $sick < 0 >>
<<set $event.push("Recover")>>
<</if>>
//
<<if $spend > 100 >>
<<set $event.push("Spend")>>
<</if>>
<<if $spend > 80 && $money > 2000>>
<<set $event.push("School")>>
<</if>>
<<if $money > 10000 >>
<<set $event.push("House")>>
<</if>>
//
<<if $week === 40>>
<<set $event.push("Birthday")>>
<<elseif $week === 41>>
<<set $event.push("Party")>>
<</if>>
/*
<<set $luck = random(1,10)>>
<<if $luck >= 7>>
<<set $event.push("Good")>>
<<elseif $luck <= 3>>
<<set $event.push("Bad")>>
<</if>>
*/
<<if $event.length >0>>
<<run slideWin("Events")>>
<</if>>
<<set $event = []>>
<<if $money < 0>>
<<goto End>>
<<else>><<goto Main>>
<</if>>
<<if $event.includes("Recover") && $recover is false>>
<<include Recover>><<set $recover to true>><</if>>
<<if $event.includes("Spend") && $seen is false>>
<<include Spend>><<set $seen to true>><</if>>
<<if $event.includes("House") && $house is false>>
<<include House>><<set $house to true>><</if>>
<<if $event.includes("School") && $school is false>>
<<include School>><<set $school to true>><</if>>
<<if $event.includes("Party")>>
<<include Party>><</if>>
<<if $event.includes("Birthday")>>
<<include Birthday>><</if>>
<<if $event.includes("Worse")>>
<<include Worse>><</if>>
<<if $event.includes("Heal")>>
<<include Heal>><</if>>
<<if $event.includes("Bad")>>
<<include Bad>><</if>>
<<if $event.includes("Good")>>
<<include Good>><</if>>
<<set $shop = {
Potion: {
Name: "Potion of Health",
BaseValue: 20,
CurrentValue: 20,
Amount: 20,
Description: "An often used item by adventures, heals minor injuries."
},
Knife: {
Name: "Knife",
BaseValue: 50,
CurrentValue: 50,
Amount: 20,
Description: "The all-in-one tool for adventurers, used for cutting cooking, digging, climbing..."
},
Cloth: {
Name: "Travel Clothes",
BaseValue: 100,
CurrentValue: 100,
Amount: 20,
Description: "Light-weight clothes especially enchanted for the dangers of traveling."
},
Orb: {
Name: "Orb of light",
BaseValue: 500,
CurrentValue: 500,
Amount: 20,
Description: "A glowing orb, useful for nighttime travels, though it's lifespan is often regarded as a mystery, there once was an orb that dies within a day!"
},
Mana: {
Name: "Mana Gems",
BaseValue: 1000,
CurrentValue: 1000,
Amount: 20,
Description: "A valued gem created by concentrated mana, a life saving gear for recharging mages in time of need."
}
}>>
<<set $inventory = {
Potion: {
Name: "Potion of Health",
BaseValue: 20,
CurrentValue: 0,
Amount: 0,
Description: "An often used item by adventures, heals minor injuries."
},
Knife: {
Name: "Knife",
BaseValue: 50,
CurrentValue: 0,
Amount: 0,
Description: "The all-in-one tool for adventurers, used for cutting cooking, digging, climbing..."
},
Cloth: {
Name: "Travel Clothes",
BaseValue: 100,
CurrentValue: 0,
Amount: 0,
Description: "Light-weight clothes especially enchanted for the dangers of traveling."
},
Orb: {
Name: "Orb of light",
BaseValue: 500,
CurrentValue: 0,
Amount: 0,
Description: "A glowing orb, useful for nighttime travels, though it's lifespan is often regarded as a mystery, there once was an orb that dies within a day!"
},
Mana: {
Name: "Mana Gems",
BaseValue: 1000,
CurrentValue: 0,
Amount: 0,
Description: "A valued gem created by concentrated mana, a life saving gear for recharging mages in time of need."
}
}>>
<<set $money = 200>>
<<set $spend = 30>>
<<set $sick = 70>>
<<set $event = []>>
<<set $seen = false>>
<<set $recover = false>>
<<set $house = false>>
<<set $school = false>>
<<set $week = 1>>
<<set $luck = 5>>
<<set $shop.Potion.CurrentValue = random(1, 50)>>
<<set $shop.Knife.CurrentValue = random(10, 150)>>
<<set $shop.Cloth.CurrentValue = random(50, 500)>>
<<set $shop.Orb.CurrentValue = random(100, 1000)>>
<<set $shop.Mana.CurrentValue = random(500, 2000)>>
<<set $shop.Potion.Amount = random(20, 1000)>>
<<set $shop.Knife.Amount = random(10, 500)>>
<<set $shop.Cloth.Amount = random(5, 500)>>
<<set $shop.Orb.Amount = random(1, 50)>>
<<set $shop.Mana.Amount = random(0, 50)>>
<div style="text-align:center;"><h1>Game Over</h1></div>
[[Restart?|Title]]
[[Credits]]Created By Xin Weng for
Thanks towards Chapel & HiEv for the use of code and support.
<div style= "text-align : center;">//Changing spending affects the wellbeen and happiness of your family, it is charged after every week. //
</div>
----
Change spending to: <<numberbox "$spend" $spend>>
<<nobr>>
<<repeat 1s>>
<<replace "#info">><<include info>><</replace>>
<</repeat>>
<</nobr>>
----
"Mother, are you truely alright?" You ask, hands in mid-air, uncertain of what to do.
"Relax," she smiled, waving her spatula around, "the doctor gave me a clean bill of health a week ago, a little bit of house work won't hurt anyone."
You shared a sheepish with your sister, whho was also kicked out of the kitchen this morning, she shrugged before leaving, probably to wake your brother.
For the first time in many days, you left the house with a lunchbox made from your mother, like all the years before.
----
"Is this ok," your sister ask, twirling in her new school uniform, the tone of awe still haven't left her voice the entire day.
"Absolutely lovely dear, now let me just fix that dress, it's a bit tight around the shoulders isn't it." The tailor says, tugging at the dress. "Your rather lucky you know, not many of us girls still gets to go to school at this age, you father must really love you."
He does, and if it wasn't for the accident she would still be at school, and not at home taking the responsiblity of the household out of mother's hand while taking care of this broken family of 4.
You see her delight at the simple dress and remembers the days and nights where she would be up by your side, doing the budget and squeezing out the last bit of time and money to keep the house afloat.
This may be your best investment yet.
----
Your siblings been acting werid this past week, cutting of inbetween sentences and busier than usual.
When you brought up your concerns with mother she just laughed and told you not to worry.
How peculiar indeed.
----
It was a big day today, you have finally earned enough money to fix your house entirely, after a full month of searching for builders and finalising plans, the project is finally beginning.
"Woohoo!" "Get of that bed you flithy pig!"
You can't help at the grin creeping up your face as you watch the antics of your siblings while mother is unpacking the clothes they brought for their stay in the tavern while the house is under contruction.
It's a lovely day indeed.
----
"Are you certain?" You sister ask, hesitant to take the money from your hand, "we're not doing too bad and you really should keep some just incase."
"I have enough," you insist, pressing the bills in her hand, "I wouldn't offer is I didn't, plus, what's the use of money if not to let us live better."
She's still hesitant when she takes it and asks you more frequently over the week, but you insist and you know you made the right choice when she no longer frowns as much when figuring out the family budget.
----
"Surprise!"
You blinked at the loud noise, instinctively catching your brother as he flings himself at you.
"Happy Birthday," you sister says more calmly, she's wearing an apron with dusting of sugar in her hair just like your brother.
Checking the date from the calender on the windowsill, you are surprised that yes, it is your birthday, has it been a year already?
You let yourself get dragged into the living room, where your mother is laying out the plates around a homemade cake, decorated with award lettering of your name, definitely your brother.
//It's a good year,// you smile as you tease your brother of his terrible handwriting and can't help but feel giddy at the effort.
They still have an extra set of culterly out sometimes, but that's ok, they're healing and it's a day for celebration and family.
----
It was a pleseant surprise to see your mother out and about in the market, helping you sister with the shopping. Her face, while still pale, glows under the sunlight and her soft voice a melody compared to the raspy coughs before.
//Everything is going to be alright,// you smile, waving a quick greeting as you rush to get to the trade port, //I just need to keep this up.//
----
"Mother!" you burst into the room, huffing from the run home.
You can see her laying on the bed, her condition has worsen over the past week but she didn't want to tell you. If it wasn't for your brother's slip of mouth, you may never know how close to losing her you were.
You stand, dazed as she comfort you with a smile that can not cover her paleness, just like when father died.
//I need to try harder,// You think, seeing your siblings trying to skip food to save money for her medicine. //I'm not going to lose another family.//
----
You were attacked by bandits on your way back, losing some of your stock.
<<nobr>>
<<set $lost = either("Potion of Health","Knife","Travel clothes","Orb of Light","Mana Gems")>>
<<set _number = random(1,200)>>
<<switch $lost>>
<<case "Potion of Health">>
<<set _stock = $inventory.Potion.Amount>>
<<if _number > _stock>>
<<set _stock = 0 >>
<<else>>
<<set _stock -= _number>>
<</if>>
<<set $inventory.Potion.Amount = _stock>>
<<case "Knife">>
<<set _stock = $inventory.Knife.Amount>>
<<if _number > _stock>>
<<set _stock = 0 >>
<<else>>
<<set _stock -= _number>>
<</if>>
<<set $inventory.Knife.Amount = _stock>>
<<case "Travel clothes">>
<<set _stock = $inventory.Cloth.Amount>>
<<if _number > _stock>>
<<set _stock = 0 >>
<<else>>
<<set _stock -= _number>>
<</if>>
<<set $inventory.Cloth.Amount = _stock>>
<<case "Orb of Light">>
<<set _stock = $inventory.Orb.Amount>>
<<if _number > _stock>>
<<set _stock = 0 >>
<<else>>
<<set _stock -= _number>>
<</if>>
<<set $inventory.Orb.Amount = _stock>>
<<case "Mana Gems">>
<<set _stock = $inventory.Mana.Amount>>
<<if _number > _stock>>
<<set _stock = 0 >>
<<else>>
<<set _stock -= _number>>
<</if>>
<<set $inventory.Mana.Amount = _stock>>
<</switch>>
<</nobr>>''----
In a stroke of luck, a traveller in search of some quick money offers you <<nobr>>
<<set $lost = either("Potion of Health","Knife","Travel clothes","Orb of Light","Mana Gems")>>
<<set _number = random(1,20)>>
<<switch $lost>>
<<case "Potion of Health">>
<<set _price = $inventory.Potion.BaseValue>>
<<set _stock = $inventory.Potion.Amount>>
<<set _total = _number * _price>>
<<if _total > $money - 100>>
<<set _number = Math.floor(($money - 100)/_price) >>
<</if>>
<<set $money -= _total>>
<<set _average = Math.floor((_stock * $inventory.Potion.CurrentValue + _total)/(_stock + _number))>>
<<if _number <= 0>><<set _number = 0>><<set _total = 0>><<set _average = 0>><</if>><<set $inventory.Potion.CurrentValue = _average>>
<<set _stock += _number>>
<<set $inventory.Potion.Amount = _stock>>
<<case "Knife">>
<<set _price = $inventory.Knife.BaseValue>>
<<set _stock = $inventory.Knife.Amount>>
<<set _total = _number * _price>>
<<if _total > $money - 100>>
<<set _number = Math.floor(($money - 100)/_price) >>
<</if>>
<<set $money -= _total>>
<<set _average = Math.floor((_stock * $inventory.Knife.CurrentValue + _total)/(_stock + _number))>>
<<if _number <= 0>><<set _number = 0>><<set _total = 0>><<set _average = 0>><</if>><<set $inventory.Knife.CurrentValue = _average>>
<<set _stock += _number>>
<<set $inventory.Knife.Amount = _stock>>
<<case "Travel clothes">>
<<set _price = $inventory.Cloth.BaseValue>>
<<set _stock = $inventory.Cloth.Amount>>
<<set _total = _number * _price>>
<<if _total > $money - 100>>
<<set _number = Math.floor(($money - 100)/_price) >>
<</if>>
<<set $money -= _total>>
<<set _average = Math.floor((_stock * $inventory.Cloth.CurrentValue + _total)/(_stock + _number))>>
<<if _number <= 0>><<set _number = 0>><<set _total = 0>><<set _average = 0>><</if>> <<set $inventory.Cloth.CurrentValue = _average>>
<<set _stock += _number>>
<<set $inventory.Cloth.Amount = _stock>>
<<case "Orb of Light">>
<<set _price = $inventory.Orb.BaseValue>>
<<set _stock = $inventory.Orb.Amount>>
<<set _total = _number * _price>>
<<if _total > $money - 100>>
<<set _number = Math.floor(($money - 100)/_price) >>
<</if>>
<<set $money -= _total>>
<<set _average = Math.floor((_stock * $inventory.Orb.CurrentValue + _total)/(_stock + _number))>>
<<if _number <= 0>><<set _number = 0>><<set _total = 0>><<set _average = 0>><</if>> <<set $inventory.Orb.CurrentValue = _average>>
<<set _stock += _number>>
<<set $inventory.Orb.Amount = _stock>>
<<case "Mana Gems">>
<<set _price = $inventory.Mana.BaseValue>>
<<set _stock = $inventory.Mana.Amount>>
<<set _total = _number * _price>>
<<if _total > $money - 100>>
<<set _number = Math.floor(($money - 100)/_price) >>
<</if>>
<<set $money -= _total>>
<<set _average = Math.floor((_stock * $inventory.Mana.CurrentValue + _total)/(_stock + _number))>>
<<if _number <= 0>><<set _number = 0>><<set _total = 0>><<set _average = 0>><</if>>
<<set $inventory.Mana.CurrentValue = _average>>
<<set _stock += _number>>
<<set $inventory.Mana.Amount = _stock>>
<</switch>>
<</nobr>>''<<=_number>>'' <<=$lost>> for ''$<<=_price>>'' each