mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
classes: armory WIP
This commit is contained in:
parent
0d0080ace4
commit
9976610652
4 changed files with 908 additions and 887 deletions
1415
dist/habitrpg-shared.js
vendored
1415
dist/habitrpg-shared.js
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -226,7 +226,7 @@ obj.score = (user, task, direction, options={}) ->
|
|||
delta += nextDelta
|
||||
|
||||
addPoints = ->
|
||||
weaponStr = items.getItem('weapon', user.items.weapon).strength
|
||||
weaponStr = items.getItem(user, 'weapon').str
|
||||
exp += obj.expModifier(delta, weaponStr, user.stats.lvl, priority) / 2 # /2 hack for now, people leveling too fast
|
||||
if streak
|
||||
gp += obj.gpModifier(delta, 1, priority, streak, user)
|
||||
|
|
@ -235,9 +235,9 @@ obj.score = (user, task, direction, options={}) ->
|
|||
|
||||
|
||||
subtractPoints = ->
|
||||
armorDef = items.getItem('armor', user.items.armor).defense
|
||||
headDef = items.getItem('head', user.items.head).defense
|
||||
shieldDef = items.getItem('shield', user.items.shield).defense
|
||||
armorDef = items.getItem(user, 'armor').con
|
||||
headDef = items.getItem(user, 'head').con
|
||||
shieldDef = items.getItem(user, 'shield').con
|
||||
hp += obj.hpModifier(delta, armorDef, headDef, shieldDef, user.stats.lvl, priority)
|
||||
|
||||
switch type
|
||||
|
|
|
|||
|
|
@ -91,17 +91,17 @@ module.exports =
|
|||
# _id / id handled by Racer
|
||||
stats: gp: 0, exp: 0, lvl: 1, hp: 50
|
||||
invitations: {party:null, guilds: []}
|
||||
items:
|
||||
weapon: 0
|
||||
armor: 0
|
||||
head: 0
|
||||
shield: 0
|
||||
lastDrop: { date: +new Date, count: 0 }
|
||||
eggs: {}
|
||||
food: {}
|
||||
hatchingPotions: {}
|
||||
pets: {}
|
||||
mounts: {}
|
||||
# items: #TODO removing while handling default items (esp. gear) via Mongoose. Revisit, we may be able to remove userSchema entirely and depend on mongoose
|
||||
# weapon: 0
|
||||
# armor: 0
|
||||
# head: 0
|
||||
# shield: 0
|
||||
# lastDrop: { date: +new Date, count: 0 }
|
||||
# eggs: {}
|
||||
# food: {}
|
||||
# hatchingPotions: {}
|
||||
# pets: {}
|
||||
# mounts: {}
|
||||
preferences:
|
||||
gender: 'm'
|
||||
skin: 'white'
|
||||
|
|
@ -239,8 +239,6 @@ module.exports =
|
|||
loc = window?.location.host or process?.env?.BASE_URL or ''
|
||||
encodeURIComponent "http://#{loc}/v1/users/#{uid}/calendar.ics?apiToken=#{apiToken}"
|
||||
|
||||
equipped: items.equipped
|
||||
|
||||
###
|
||||
Gold amount from their money
|
||||
###
|
||||
|
|
@ -338,6 +336,7 @@ module.exports =
|
|||
(level-1) / 2
|
||||
|
||||
totalStr: (level, weapon=0) ->
|
||||
return 'FIXME'
|
||||
str = (level-1) / 2
|
||||
(str + items.getItem('weapon', weapon).strength)
|
||||
|
||||
|
|
@ -345,6 +344,7 @@ module.exports =
|
|||
(level-1) / 2
|
||||
|
||||
totalDef: (level, armor=0, head=0, shield=0) ->
|
||||
return 'FIXME'
|
||||
totalDef =
|
||||
(level - 1) / 2 + # defense
|
||||
items.getItem('armor', armor).defense +
|
||||
|
|
@ -353,9 +353,11 @@ module.exports =
|
|||
return totalDef
|
||||
|
||||
itemText: (type, item=0) ->
|
||||
return 'FIXME'
|
||||
items.getItem(type, item).text
|
||||
|
||||
itemStat: (type, item=0) ->
|
||||
return 'FIXME'
|
||||
i = items.getItem(type, item)
|
||||
if type is 'weapon' then i.strength else i.defense
|
||||
|
||||
|
|
|
|||
|
|
@ -9,162 +9,148 @@ items = module.exports.items = {}
|
|||
---------------------------------------------------------------
|
||||
###
|
||||
|
||||
gear =
|
||||
weapon:
|
||||
warrior:
|
||||
0: text: "Training Sword", notes:'Practice weapon. Confers no benefit.', value:0
|
||||
1: text: "Sword", notes:'Common soldier\'s blade. Increases STR by 3.', str: 3, value:20
|
||||
2: text: "Axe", notes:'Double-bitted battle-axe. Increases STR by 6.', str: 6, value:30
|
||||
3: text: "Morning Star", notes:'Heavy club with brutal spikes. Increases STR by 9.', str: 9, value:45
|
||||
4: text: "Sapphire Blade", notes:'Sword whose edge bites like the north wind. Increases STR by 12.', str: 12, value:65
|
||||
5: text: "Ruby Sword", notes:'Weapon whose forge-glow never fades. Increases STR by 15.', str: 15, value:90
|
||||
6: text: "Golden Sword", notes:'Bane of creatures of darkness. Increases STR by 18.', str: 18, value:120, last: true
|
||||
rogue:
|
||||
0: text: "Practice Bow", notes:'Training weapon. Confers no benefit.', value:0
|
||||
1: text: "Short Bow", notes:'Simple bow best at close ranges. Increases STR by 2.', str: 2, value:20
|
||||
2: text: "Long Bow", notes:'Bow with a strong draw for extra distance. Increases STR by 5.', str: 5, value:50
|
||||
3: text: "Recurve Bow", notes:'Built with advanced techniques. Increases STR by 8.', str: 8, value:80
|
||||
4: text: "Icicle Bow", notes:'Fires arrows of piercing cold. Increases STR by 12.', str: 12, value:120
|
||||
5: text: "Meteor Bow", notes:'Rains flame upon your foes. Increases STR by 16.', str: 16, value:160
|
||||
6: text: "Golden Bow", notes:'As swift as sunlight and as sharp as lightning. Increases STR by 20.', str: 20, value:200, last: true
|
||||
mage:
|
||||
0: text: "Apprentice Staff", notes:'Practice staff. Confers no benefit.', value:0
|
||||
1: text: "Wooden Staff", notes:'Basic implement of carven wood. Increases INT by 3 and PER by 1.', int: 3, per: 1, value:30
|
||||
2: text: "Jeweled Staff", notes:'Focuses power through a precious stone. Increases INT by 6 and PER by 2.', int: 6, per: 2, value:50
|
||||
3: text: "Iron Staff", notes:'Plated in metal to channel heat, cold, and lightning. Increases INT by 9 and PER by 3.', int: 9, per: 3, value:80
|
||||
4: text: "Brass Staff", notes:'As powerful as it is heavy. Increases INT by 12 and PER by 5.', int:12, per: 5, value:120
|
||||
5: text: "Archmage Staff", notes:'Assists in weaving the most complex of spells. Increases INT by 15 and PER by 7.', int: 15, per: 7, value:160
|
||||
6: text: "Golden Staff", notes:'Fashioned of orichalcum, the alchemic gold, mighty and rare. Increases INT by 18 and PER by 9.', int: 18, per: 9, value:200, last: true
|
||||
healer:
|
||||
0: text: "Novice Rod", notes:'For healers in training. Confers no benefit.', value:0
|
||||
1: text: "Acolyte Rod", notes:'Crafted during a healer\'s initiation. Increases INT by 2.', int: 2, value:20
|
||||
2: text: "Quartz Rod", notes:'Topped with a gem bearing curative properties. Increases INT by 3.', int: 3, value:30
|
||||
3: text: "Amethyst Rod", notes:'Purifies poison at a touch. Increases INT by 5.', int: 5, value:45
|
||||
4: text: "Priest Rod", notes:'As much a badge of office as a healing tool. Increases INT by 7.', int:7, value:65
|
||||
5: text: "Royal Crosier", notes:'Shines with the pure light of blessings. Increases INT by 9.', int: 9, value:90
|
||||
6: text: "Golden Crosier", notes:'Soothes the pain of all who look upon it. Increases INT by 11.', int: 11, value:120, last: true
|
||||
special:
|
||||
0: text: "Dark Souls Blade", notes:'Increases experience gain by 21%.', str: 21, value:150, canOwn: ((u)-> +u.backer?.tier >= 70)
|
||||
1: text: "Crystal Blade", notes:'Increases experience gain by 24%.', str: 24, value:170, canOwn: ((u)-> +u.contributor?.level >= 4)
|
||||
|
||||
armor:
|
||||
warrior:
|
||||
0: text: "Cloth Armor", notes:'Ordinary clothing. Confers no benefit.', value:0
|
||||
1: text: "Leather Armor", notes:'Jerkin of sturdy boiled hide. Increases CON by 3.', con: 3, value:30
|
||||
2: text: "Chain Mail", notes:'Armor of interlocked metal rings. Increases CON by 5.', con: 5, value:45
|
||||
3: text: "Plate Armor", notes:'Suit of all-encasing steel, the pride of knights. Increases CON by 7.', con: 7, value:65
|
||||
4: text: "Red Armor", notes:'Heavy plate glowing with defensive enchantments. Increases CON by 9.', con: 9, value:90
|
||||
5: text: "Golden Armor", notes:'Looks ceremonial, but no known blade can pierce it. Increases CON by 11.', con: 11, value:120, last: true
|
||||
rogue:
|
||||
0: text: "Cloth Armor", notes:'Ordinary clothing. Confers no benefit.', value:0
|
||||
1: text: "Oiled Leather", notes:'Leather armor treated to reduce noise. Increases PER by 6.', per: 6, value:30
|
||||
2: text: "Black Leather", notes:'Colored with dark dye to blend into shadows. Increases PER by 9', per: 9, value:45
|
||||
3: text: "Camouflage Vest", notes:'Equally discreet in dungeon or wilderness. Increases PER by 12.', per: 12, value:65
|
||||
4: text: "Penumbral Armor", notes:'Wraps the wearer in a veil of twilight. Increases PER by 15.', per: 15, value:90
|
||||
5: text: "Umbral Armor", notes:'Allows stealth in the open in broad daylight. Increases PER by 18.', per: 18, value:120, last: true
|
||||
mage:
|
||||
0: text: "Apprentice Garb", notes:'For students of magic. Confers no benefit.', value:0
|
||||
1: text: "Magician Robe", notes:'Hedge-mage\'s outfit. Increases INT by 2.', int: 2, value:30
|
||||
2: text: "Wizard Robe", notes:'Clothes for a wandering wonder-worker. Increases INT by 4.', int: 4, value:45
|
||||
3: text: "Robe of Mysteries", notes:'Denotes initiation into elite secrets. Increases INT by 6.', int: 6, value:65
|
||||
4: text: "Archmage Robe", notes:'Spirits and elementals bow before it. Increases INT by 9.', int: 9, value:90
|
||||
5: text: "Royal Magus Robe", notes:'Symbol of the power behind the throne. Increases INT by 12.', int: 12, value:120, last: true
|
||||
healer:
|
||||
0: text: "Novice Robe", notes:'For healers in training. Confers no benefit.', value:0
|
||||
1: text: "Acolyte Robe", notes:'Garment showing humility and purpose. Increases CON by 6.', con: 6, value:30
|
||||
2: text: "Medic Robe", notes:'Worn by those dedicated to tending the wounded in battle. Increases CON by 9.', con: 9, value:45
|
||||
3: text: "Defender Vestment", notes:'Turns the healer\'s own magics inward to fend off harm. Increases CON by 12.', con: 12, value:65
|
||||
4: text: "Priest Vestment", notes:'Projects authority and dissipates curses. Increases CON by 15.', con: 15, value:90
|
||||
5: text: "Royal Vestment", notes:'Attire of those who have saved the lives of kings. Increases CON by 18.', con: 18, value:120, last: true
|
||||
special:
|
||||
0: text: "Shade Armor", notes:'Decreases Health loss by 12%.', defense: 12, value:150, canOwn: ((u)-> +u.backer?.tier >= 45)
|
||||
1: text: "Crystal Armor", notes:'Decreases Health loss by 14%.', defense: 14, value:170, canOwn: ((u)-> +u.contributor?.level >= 2)
|
||||
|
||||
head:
|
||||
warrior:
|
||||
0: text: "No Helm", notes:'No headgear.', value:0
|
||||
1: text: "Leather Helm", notes:'Cap of sturdy boiled hide. Increases STR by 2.', str: 2, value:15
|
||||
2: text: "Chain Coif", notes:'Hood of interlocked metal rings. Increases STR by 4.', str: 4, value:25
|
||||
3: text: "Plate Helm", notes:'Thick steel helmet, proof against any blow. Increases STR by 6.', str: 6, value:40
|
||||
4: text: "Red Helm", notes:'Set with rubies for power, and glows when the wearer is angered. Increases STR by 9.', str: 9, value:60
|
||||
5: text: "Golden Helm", notes:'Regal crown bound to shining armor. Increases STR by 12.', str: 12, value:80, last: true
|
||||
rogue:
|
||||
0: text: "No Hood", notes:'No headgear.', value:0
|
||||
1: text: "Leather Hood", notes:'Basic protective cowl. Increases PER by 2.', per: 2, value:15
|
||||
2: text: "Black Leather Hood", notes:'Useful for both defense and disguise. Increases PER by 4.', per: 4, value:25
|
||||
3: text: "Camouflage Hood", notes:'Rugged, but doesn\'t impede hearing. Increases PER by 6.', per: 6, value:40
|
||||
4: text: "Penumbral Hood", notes:'Grants perfect vision in darkness. Increases PER by 9.', per: 9, value:60
|
||||
5: text: "Umbral Hood", notes:'Conceals even thoughts from those who would probe them. Increases PER by 12.', per: 12, value:80, last: true
|
||||
mage:
|
||||
0: text: "No Hat", notes:'No headgear.', value:0
|
||||
1: text: "Magician Hat", notes:'Simple, comfortable, and fashionable. Increases PER by 2.', per: 2, value:15
|
||||
2: text: "Cornuthaum", notes:'Traditional headgear of the itinerant wizard. Increases PER by 3.', per: 3, value:25
|
||||
3: text: "Astrologer Hat", notes:'Adorned with the rings of Saturn. Increases PER by 5.', per: 5, value:40
|
||||
4: text: "Archmage Hat", notes:'Focuses the mind for intensive spellcasting. Increases PER by 7.', per: 7, value:60
|
||||
5: text: "Royal Magus Hat", notes:'Shows authority over fortune, weather, and lesser mages. Increases PER by 9.', per: 9, value:80, last: true
|
||||
healer:
|
||||
0: text: "No Circlet", notes:'No headgear.', value:0
|
||||
1: text: "Quartz Circlet", notes:'Jeweled headpiece, for focus on the task at hand. Increases INT by 2.', int: 2, value:15
|
||||
2: text: "Amethyst Circlet", notes:'A taste of luxury for a humble profession. Increases INT by 3.', int: 3, value:25
|
||||
3: text: "Sapphire Circlet", notes:'Shines to let sufferers know their salvation is at hand. Increases INT by 5.', int: 5, value:40
|
||||
4: text: "Emerald Diadem", notes:'Emits an aura of life and growth. Increases INT by 7.', int: 7, value:60
|
||||
5: text: "Royal Diadem", notes:'For king, queen, or miracle-worker. Increases INT by 9.', int: 9, value:80, last: true
|
||||
special:
|
||||
0: text: "Shade Helm", notes:'Decreases Health loss by 7%.', defense: 7, value:100, canOwn: ((u)-> +u.backer?.tier >= 45)
|
||||
1: text: "Crystal Helm", notes:'Decreases Health loss by 8%.', defense: 8, value:120, canOwn: ((u)-> +u.contributor?.level >= 3)
|
||||
|
||||
shield:
|
||||
warrior:
|
||||
0: text: "No Shield", notes:'No shield.', value:0
|
||||
1: text: "Wooden Shield", notes:'Round shield of thick wood. Increases CON by 2.', con: 2, value:20
|
||||
2: text: "Buckler", notes:'Light and sturdy, quick to bring to the defense. Increases CON by 3.', con: 3, value:35
|
||||
3: text: "Reinforced Shield", notes:'Made of wood but bolstered with metal bands. Increases CON by 5.', con: 5, value:50
|
||||
4: text: "Red Shield", notes:'Rebukes blows with a burst of flame. Increases CON by 7.', con: 7, value:70
|
||||
5: text: "Golden Shield", notes:'Shining badge of the vanguard. Increases CON by 9.', con: 9, value:90, last: true
|
||||
rogue:
|
||||
0: text: "No Shield", notes:'No shield.', value:0, last: true
|
||||
mage:
|
||||
0: text: "No Shield", notes:'No shield.', def: 0, value:0, last: true
|
||||
healer:
|
||||
0: text: "No Shield", notes:'No shield.', def: 0, value:0
|
||||
1: text: "Medic Buckler", notes:'Easy to disengage, freeing a hand for bandaging. Increases CON by 2.', con: 2, value:20
|
||||
2: text: "Kite Shield", notes:'Tapered shield with the symbol of healing. Increases CON by 4.', con: 4, value:35
|
||||
3: text: "Hospitaler Shield", notes:'Traditional shield of defender knights. Increases CON by 6.', con: 6, value:50
|
||||
4: text: "Savior Shield", notes:'Turns blows from innocents as well as oneself. Increases CON by 9.', con: 9, value:70
|
||||
5: text: "Royal Shield", notes:'Bestowed upon those most dedicated to the kingdom\'s defense. Increases CON by 12.', con: 12, value:90, last: true
|
||||
special:
|
||||
0: text: "Tormented Skull", notes:'Decreases Health loss by 9%.', defense: 9, value:120, canOwn: ((u)-> +u.backer?.tier >= 45)
|
||||
1: text: "Crystal Shield", notes:'Decreases Health loss by 10%.', defense: 10, value:150, canOwn: ((u)-> +u.contributor?.level >= 5)
|
||||
|
||||
###
|
||||
FIXME
|
||||
{index: 7, text: "Dark Souls Blade", classes:'weapon_7', notes:'Increases experience gain by 21%.', str: 21, value:150, canOwn: ((u)-> +u.backer?.tier >= 70)}
|
||||
{index: 8, text: "Crystal Blade", classes:'weapon_8', notes:'Increases experience gain by 24%.', str: 24, value:170, canOwn: ((u)-> +u.contributor?.level >= 4)}
|
||||
|
||||
{index: 6, text: "Shade Armor", notes:'Decreases Health loss by 12%.', defense: 12, value:150, canOwn: ((u)-> +u.backer?.tier >= 45)}
|
||||
{index: 7, text: "Crystal Armor", notes:'Decreases Health loss by 14%.', defense: 14, value:170, canOwn: ((u)-> +u.contributor?.level >= 2)}
|
||||
|
||||
{index: 6, text: "Shade Helm", notes:'Decreases Health loss by 7%.', defense: 7, value:100, canOwn: ((u)-> +u.backer?.tier >= 45)}
|
||||
{index: 7, text: "Crystal Helm", notes:'Decreases Health loss by 8%.', defense: 8, value:120, canOwn: ((u)-> +u.contributor?.level >= 3)}
|
||||
|
||||
{index: 6, text: "Tormented Skull", notes:'Decreases Health loss by 9%.', defense: 9, value:120, canOwn: ((u)-> +u.backer?.tier >= 45)}
|
||||
{index: 7, text: "Crystal Shield", notes:'Decreases Health loss by 10%.', defense: 10, value:150, canOwn: ((u)-> +u.contributor?.level >= 5)}
|
||||
The gear is exported as a tree (defined above), and a flat list (eg, {weapon_healer_1: .., shield_special_0: ...}) since
|
||||
they are needed in different froms at different points in the app
|
||||
###
|
||||
items.gear =
|
||||
tree: gear
|
||||
flat: {}
|
||||
|
||||
items.weapon =
|
||||
warrior: [
|
||||
{index: 0, text: "Training Sword", notes:'Practice weapon. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Sword", notes:'Common soldier\'s blade. Increases STR by 3.', str: 3, value:20}
|
||||
{index: 2, text: "Axe", notes:'Double-bitted battle-axe. Increases STR by 6.', str: 6, value:30}
|
||||
{index: 3, text: "Morning Star", notes:'Heavy club with brutal spikes. Increases STR by 9.', str: 9, value:45}
|
||||
{index: 4, text: "Sapphire Blade", notes:'Sword whose edge bites like the north wind. Increases STR by 12.', str: 12, value:65}
|
||||
{index: 5, text: "Ruby Sword", notes:'Weapon whose forge-glow never fades. Increases STR by 15.', str: 15, value:90}
|
||||
{index: 6, text: "Golden Sword", notes:'Bane of creatures of darkness. Increases STR by 18.', str: 18, value:120}
|
||||
]
|
||||
rogue: [
|
||||
{index: 0, text: "Practice Bow", notes:'Training weapon. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Short Bow", notes:'Simple bow best at close ranges. Increases STR by 2.', str: 2, value:20}
|
||||
{index: 2, text: "Long Bow", notes:'Bow with a strong draw for extra distance. Increases STR by 5.', str: 5, value:50}
|
||||
{index: 3, text: "Recurve Bow", notes:'Built with advanced techniques. Increases STR by 8.', str: 8, value:80}
|
||||
{index: 4, text: "Icicle Bow", notes:'Fires arrows of piercing cold. Increases STR by 12.', str: 12, value:120}
|
||||
{index: 5, text: "Meteor Bow", notes:'Rains flame upon your foes. Increases STR by 16.', str: 16, value:160}
|
||||
{index: 6, text: "Golden Bow", notes:'As swift as sunlight and as sharp as lightning. Increases STR by 20.', str: 20, value:200}
|
||||
]
|
||||
mage: [
|
||||
{index: 0, text: "Apprentice Staff", notes:'Practice staff. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Wooden Staff", notes:'Basic implement of carven wood. Increases INT by 3 and PER by 1.', int: 3, per: 1, value:30}
|
||||
{index: 2, text: "Jeweled Staff", notes:'Focuses power through a precious stone. Increases INT by 6 and PER by 2.', int: 6, per: 2, value:50}
|
||||
{index: 3, text: "Iron Staff", notes:'Plated in metal to channel heat, cold, and lightning. Increases INT by 9 and PER by 3.', int: 9, per: 3, value:80}
|
||||
{index: 4, text: "Brass Staff", notes:'As powerful as it is heavy. Increases INT by 12 and PER by 5.', int:12, per: 5, value:120}
|
||||
{index: 5, text: "Archmage Staff", notes:'Assists in weaving the most complex of spells. Increases INT by 15 and PER by 7.', int: 15, per: 7, value:160}
|
||||
{index: 6, text: "Golden Staff", notes:'Fashioned of orichalcum, the alchemic gold, mighty and rare. Increases INT by 18 and PER by 9.', int: 18, per: 9, value:200}
|
||||
]
|
||||
healer: [
|
||||
{index: 0, text: "Novice Rod", notes:'For healers in training. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Acolyte Rod", notes:'Crafted during a healer\'s initiation. Increases INT by 2.', int: 2, value:20}
|
||||
{index: 2, text: "Quartz Rod", notes:'Topped with a gem bearing curative properties. Increases INT by 3.', int: 3, value:30}
|
||||
{index: 3, text: "Amethyst Rod", notes:'Purifies poison at a touch. Increases INT by 5.', int: 5, value:45}
|
||||
{index: 4, text: "Priest Rod", notes:'As much a badge of office as a healing tool. Increases INT by 7.', int:7, value:65}
|
||||
{index: 5, text: "Royal Crosier", notes:'Shines with the pure light of blessings. Increases INT by 9.', int: 9, value:90}
|
||||
{index: 6, text: "Golden Crosier", notes:'Soothes the pain of all who look upon it. Increases INT by 11.', int: 11, value:120}
|
||||
]
|
||||
|
||||
items.armor =
|
||||
warrior: [
|
||||
{index: 0, text: "Cloth Armor", notes:'Ordinary clothing. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Leather Armor", notes:'Jerkin of sturdy boiled hide. Increases CON by 3.', con: 3, value:30}
|
||||
{index: 2, text: "Chain Mail", notes:'Armor of interlocked metal rings. Increases CON by 5.', con: 5, value:45}
|
||||
{index: 3, text: "Plate Armor", notes:'Suit of all-encasing steel, the pride of knights. Increases CON by 7.', con: 7, value:65}
|
||||
{index: 4, text: "Red Armor", notes:'Heavy plate glowing with defensive enchantments. Increases CON by 9.', con: 9, value:90}
|
||||
{index: 5, text: "Golden Armor", notes:'Looks ceremonial, but no known blade can pierce it. Increases CON by 11.', con: 11, value:120}
|
||||
]
|
||||
rogue: [
|
||||
{index: 0, text: "Cloth Armor", notes:'Ordinary clothing. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Oiled Leather", notes:'Leather armor treated to reduce noise. Increases PER by 6.', per: 6, value:30}
|
||||
{index: 2, text: "Black Leather", notes:'Colored with dark dye to blend into shadows. Increases PER by 9', per: 9, value:45}
|
||||
{index: 3, text: "Camouflage Vest", notes:'Equally discreet in dungeon or wilderness. Increases PER by 12.', per: 12, value:65}
|
||||
{index: 4, text: "Penumbral Armor", notes:'Wraps the wearer in a veil of twilight. Increases PER by 15.', per: 15, value:90}
|
||||
{index: 5, text: "Umbral Armor", notes:'Allows stealth in the open in broad daylight. Increases PER by 18.', per: 18, value:120}
|
||||
]
|
||||
mage: [
|
||||
{index: 0, text: "Apprentice Garb", notes:'For students of magic. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Magician Robe", notes:'Hedge-mage\'s outfit. Increases INT by 2.', int: 2, value:30}
|
||||
{index: 2, text: "Wizard Robe", notes:'Clothes for a wandering wonder-worker. Increases INT by 4.', int: 4, value:45}
|
||||
{index: 3, text: "Robe of Mysteries", notes:'Denotes initiation into elite secrets. Increases INT by 6.', int: 6, value:65}
|
||||
{index: 4, text: "Archmage Robe", notes:'Spirits and elementals bow before it. Increases INT by 9.', int: 9, value:90}
|
||||
{index: 5, text: "Royal Magus Robe", notes:'Symbol of the power behind the throne. Increases INT by 12.', int: 12, value:120}
|
||||
]
|
||||
healer: [
|
||||
{index: 0, text: "Novice Robe", notes:'For healers in training. Confers no benefit.', value:0}
|
||||
{index: 1, text: "Acolyte Robe", notes:'Garment showing humility and purpose. Increases CON by 6.', con: 6, value:30}
|
||||
{index: 2, text: "Medic Robe", notes:'Worn by those dedicated to tending the wounded in battle. Increases CON by 9.', con: 9, value:45}
|
||||
{index: 3, text: "Defender Vestment", notes:'Turns the healer\'s own magics inward to fend off harm. Increases CON by 12.', con: 12, value:65}
|
||||
{index: 4, text: "Priest Vestment", notes:'Projects authority and dissipates curses. Increases CON by 15.', con: 15, value:90}
|
||||
{index: 5, text: "Royal Vestment", notes:'Attire of those who have saved the lives of kings. Increases CON by 18.', con: 18, value:120}
|
||||
]
|
||||
|
||||
items.head =
|
||||
warrior: [
|
||||
{index: 0, text: "No Helm", notes:'No headgear.', value:0}
|
||||
{index: 1, text: "Leather Helm", notes:'Cap of sturdy boiled hide. Increases STR by 2.', str: 2, value:15}
|
||||
{index: 2, text: "Chain Coif", notes:'Hood of interlocked metal rings. Increases STR by 4.', str: 4, value:25}
|
||||
{index: 3, text: "Plate Helm", notes:'Thick steel helmet, proof against any blow. Increases STR by 6.', str: 6, value:40}
|
||||
{index: 4, text: "Red Helm", notes:'Set with rubies for power, and glows when the wearer is angered. Increases STR by 9.', str: 9, value:60}
|
||||
{index: 5, text: "Golden Helm", notes:'Regal crown bound to shining armor. Increases STR by 12.', str: 12, value:80}
|
||||
]
|
||||
rogue: [
|
||||
{index: 0, text: "No Hood", notes:'No headgear.', value:0}
|
||||
{index: 1, text: "Leather Hood", notes:'Basic protective cowl. Increases PER by 2.', per: 2, value:15}
|
||||
{index: 2, text: "Black Leather Hood", notes:'Useful for both defense and disguise. Increases PER by 4.', per: 4, value:25}
|
||||
{index: 3, text: "Camouflage Hood", notes:'Rugged, but doesn\'t impede hearing. Increases PER by 6.', per: 6, value:40}
|
||||
{index: 4, text: "Penumbral Hood", notes:'Grants perfect vision in darkness. Increases PER by 9.', per: 9, value:60}
|
||||
{index: 5, text: "Umbral Hood", notes:'Conceals even thoughts from those who would probe them. Increases PER by 12.', per: 12, value:80}
|
||||
]
|
||||
mage: [
|
||||
{index: 0, text: "No Hat", notes:'No headgear.', value:0}
|
||||
{index: 1, text: "Magician Hat", notes:'Simple, comfortable, and fashionable. Increases PER by 2.', per: 2, value:15}
|
||||
{index: 2, text: "Cornuthaum", notes:'Traditional headgear of the itinerant wizard. Increases PER by 3.', per: 3, value:25}
|
||||
{index: 3, text: "Astrologer Hat", notes:'Adorned with the rings of Saturn. Increases PER by 5.', per: 5, value:40}
|
||||
{index: 4, text: "Archmage Hat", notes:'Focuses the mind for intensive spellcasting. Increases PER by 7.', per: 7, value:60}
|
||||
{index: 5, text: "Royal Magus Hat", notes:'Shows authority over fortune, weather, and lesser mages. Increases PER by 9.', per: 9, value:80}
|
||||
]
|
||||
healer: [
|
||||
{index: 0, text: "No Circlet", notes:'No headgear.', value:0}
|
||||
{index: 1, text: "Quartz Circlet", notes:'Jeweled headpiece, for focus on the task at hand. Increases INT by 2.', int: 2, value:15}
|
||||
{index: 2, text: "Amethyst Circlet", notes:'A taste of luxury for a humble profession. Increases INT by 3.', int: 3, value:25}
|
||||
{index: 3, text: "Sapphire Circlet", notes:'Shines to let sufferers know their salvation is at hand. Increases INT by 5.', int: 5, value:40}
|
||||
{index: 4, text: "Emerald Diadem", notes:'Emits an aura of life and growth. Increases INT by 7.', int: 7, value:60}
|
||||
{index: 5, text: "Royal Diadem", notes:'For king, queen, or miracle-worker. Increases INT by 9.', int: 9, value:80}
|
||||
]
|
||||
|
||||
|
||||
items.shield =
|
||||
warrior: [
|
||||
{index: 0, text: "No Shield", notes:'No shield.', value:0}
|
||||
{index: 1, text: "Wooden Shield", notes:'Round shield of thick wood. Increases CON by 2.', con: 2, value:20}
|
||||
{index: 2, text: "Buckler", notes:'Light and sturdy, quick to bring to the defense. Increases CON by 3.', con: 3, value:35}
|
||||
{index: 3, text: "Reinforced Shield", notes:'Made of wood but bolstered with metal bands. Increases CON by 5.', con: 5, value:50}
|
||||
{index: 4, text: "Red Shield", notes:'Rebukes blows with a burst of flame. Increases CON by 7.', con: 7, value:70}
|
||||
{index: 5, text: "Golden Shield", notes:'Shining badge of the vanguard. Increases CON by 9.', con: 9, value:90}
|
||||
]
|
||||
rogue: [
|
||||
{index: 0, text: "No Shield", notes:'No shield.', value:0}
|
||||
]
|
||||
mage: [
|
||||
{index: 0, text: "No Shield", notes:'No shield.', def: 0, value:0}
|
||||
]
|
||||
healer: [
|
||||
{index: 0, text: "No Shield", notes:'No shield.', def: 0, value:0}
|
||||
{index: 1, text: "Medic Buckler", notes:'Easy to disengage, freeing a hand for bandaging. Increases CON by 2.', con: 2, value:20}
|
||||
{index: 2, text: "Kite Shield", notes:'Tapered shield with the symbol of healing. Increases CON by 4.', con: 4, value:35}
|
||||
{index: 3, text: "Hospitaler Shield", notes:'Traditional shield of defender knights. Increases CON by 6.', con: 6, value:50}
|
||||
{index: 4, text: "Savior Shield", notes:'Turns blows from innocents as well as oneself. Increases CON by 9.', con: 9, value:70}
|
||||
{index: 5, text: "Royal Shield", notes:'Bestowed upon those most dedicated to the kingdom\'s defense. Increases CON by 12.', con: 12, value:90}
|
||||
]
|
||||
|
||||
# we sometimes want item arrays above in reverse order, for backward lookups (you'll see later in the code)
|
||||
reversed = {}
|
||||
_.each ['weapon', 'armor', 'head', 'shield'], (type) ->
|
||||
reversed[type] = {}
|
||||
_.each ['warrior', 'rogue', 'healer', 'wizard'], (_class) ->
|
||||
reversed[type][_class] = items[type][_class].slice().reverse()
|
||||
_.each ['warrior', 'rogue', 'healer', 'wizard', 'special'], (_class_) ->
|
||||
# add "type" to each item, so we can reference that as "weapon" or "armor" in the html
|
||||
# Also add canOwn(), which we use when comparing if user is a backer or contributor - but defaulted to `return true`
|
||||
_.each items[type][_class], (item, i) ->
|
||||
_.defaults(item, {type, canOwn: (->true), classes: "#{type}_#{i}-#{_class}", str:0, int:0, per:0, def:0})
|
||||
_.each gear[type][_class_], (item, i) ->
|
||||
key = "#{type}_#{_class_}_#{i}"
|
||||
_.defaults item, {type, key, index: i, str:0, int:0, per:0, con:0}
|
||||
items.gear.flat[key] = item
|
||||
|
||||
###
|
||||
---------------------------------------------------------------
|
||||
|
|
@ -173,7 +159,7 @@ _.each ['weapon', 'armor', 'head', 'shield'], (type) ->
|
|||
---------------------------------------------------------------
|
||||
###
|
||||
|
||||
items.potion = type: 'potion', text: "Health Potion", notes: "Recover 15 Health (Instant Use)", value: 25, classes: 'potion'
|
||||
items.potion = type: 'potion', text: "Health Potion", notes: "Recover 15 Health (Instant Use)", value: 25, key: 'potion'
|
||||
items.reroll = type: 'reroll', text: "Re-Roll", notes: "Resets your task values back to 0 (yellow). Useful when everything's red and it's hard to stay alive.", value:0
|
||||
|
||||
###
|
||||
|
|
@ -413,20 +399,29 @@ _.each items.food, (food,k) ->
|
|||
---------------------------------------------------------------
|
||||
###
|
||||
|
||||
# TODO remove once we have proper migrations and validation in place
|
||||
_class = (user) -> if (user.stats.class in ['warrior','healer','wizard','rogue']) then user.stats.class else 'warrior'
|
||||
|
||||
###
|
||||
FIXME
|
||||
###
|
||||
module.exports.buyItem = (user, type) ->
|
||||
nextItem =
|
||||
if type is 'potion' then items.potion
|
||||
else _.find items[type][user.stats.class || 'warrior'].slice(~~user.items[type] + 1), ((i) -> i.canOwn user)
|
||||
else
|
||||
i = module.exports.getItem(user, type).index
|
||||
items.gear.flat["#{type}_#{_class(user)}_#{+i + 1}"]
|
||||
|
||||
return false if +user.stats.gp < +nextItem.value
|
||||
if nextItem.type is 'potion'
|
||||
user.stats.hp += 15;
|
||||
user.stats.hp = 50 if user.stats.hp > 50
|
||||
else
|
||||
user.items[type] = ~~nextItem.index
|
||||
if +user.items.weapon >= 6 and +user.items.armor >= 5 and +user.items.head >= 5 and +user.items.shield >= 5
|
||||
user.items.gear.current[type] = nextItem.key
|
||||
user.items.gear.owned[nextItem.key] = true;
|
||||
if getItem(user,'weapon').last && getItem(user,'armor').last && getItem(user,'head').last && getItem(user,'shield').last
|
||||
user.achievements.ultimateGear = true;
|
||||
user.stats.gp -= +nextItem.value
|
||||
user.stats.gp -= nextItem.value
|
||||
true
|
||||
|
||||
###
|
||||
|
|
@ -435,9 +430,8 @@ module.exports.buyItem = (user, type) ->
|
|||
module.exports.updateStore = (user) ->
|
||||
changes = {}
|
||||
_.each ['weapon', 'armor', 'shield', 'head'], (type) ->
|
||||
# Find the first item that fits the "next" bill, from between current item and end of the list
|
||||
curr = user.items?[type] or 0
|
||||
changes[type] = _.find(items[type][user.stats.class || 'warrior'].slice(curr+1), ((item) -> item.canOwn user)) or {hide:true}
|
||||
i = module.exports.getItem(user, type).index
|
||||
changes[type] = items.gear.flat["#{type}_#{_class(user)}_#{+i + 1}"] or {hide:true}
|
||||
changes.potion = items.potion
|
||||
changes.reroll = items.reroll
|
||||
changes
|
||||
|
|
@ -445,31 +439,7 @@ module.exports.updateStore = (user) ->
|
|||
###
|
||||
Gets an item, and caps max to the last item in its array
|
||||
###
|
||||
module.exports.getItem = (type, index=0) ->
|
||||
# FIXME
|
||||
return items[type].warrior[1]
|
||||
# if they set their gear manually to something over what they can own, just set to 0 to avoid errors
|
||||
i = if (~~index > items[type].warrior.length - 1) then 0 else ~~index
|
||||
items[type].warrior[i]
|
||||
|
||||
###
|
||||
User's currently equiped item
|
||||
TODO this function is ugly, find a more elegant solution
|
||||
###
|
||||
module.exports.equipped = (type, user) ->
|
||||
#FIXME handle contrib & backer
|
||||
# lastStandardItem = items[type].length - 3 # -1 for 0-based index, -2 for backer + contrib
|
||||
# if (item > lastStandardItem) and !items[type][item]?.canOwn({backer,contributor})
|
||||
# # They entered a # above what's legal in the restore dialog, find first legit item. (we should do checking on the restore-save instead)
|
||||
# item = _.find(reversed[type], ((i) -> i.canOwn({backer, contributor}))).index
|
||||
|
||||
# backer / contrib (they don't have gender)
|
||||
# return "#{type}_#{item}" if (item > lastStandardItem)
|
||||
|
||||
# # Females have some special thing going on for their armor / helms
|
||||
# if (type in ['armor', 'head'] and pref.gender is 'f')
|
||||
# return "f_armor_#{item}_#{pref.armorSet}" if (item is 0 and type is 'armor')
|
||||
# return "f_head_#{item}_#{pref.armorSet}" if (item > 1 and type is 'head')
|
||||
#
|
||||
# return "#{pref.gender}_#{type}_#{item}"
|
||||
return "m_#{type}_#{item.items[type]}-#{user.stats.class}"
|
||||
module.exports.getItem = getItem = (user, type) ->
|
||||
item = items.gear.flat[user.items.gear.current[type]]
|
||||
return items.gear.flat["#{type}_#{_class(user)}_0"] unless item
|
||||
item
|
||||
Loading…
Reference in a new issue