Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jon's pr #106

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
e53f004
level one work
Fezz-xiii Dec 30, 2020
cb59f8b
changes and tweaks to stageOne & framework for stageOneTwo
Fezz-xiii Jan 1, 2021
e1d1312
more tweaks to dmg | fixed reference errors
Fezz-xiii Jan 3, 2021
821a78e
changes to enDmg
Fezz-xiii Jan 4, 2021
a01de7b
general update
Fezz-xiii Jan 6, 2021
27a97b5
implemented objects in place of arrays as function arguments
Fezz-xiii Jan 6, 2021
86dcbe2
more changes to implement objects
Fezz-xiii Jan 6, 2021
dab1c0c
refactoring
Fezz-xiii Jan 25, 2021
642a139
minor tweaks and bug fixes, loop is running kinda
Fezz-xiii Jan 25, 2021
4bb85d5
heroStats obj now to host character stats
Fezz-xiii Mar 21, 2021
7ec55dd
constitutionRoll replaces addHealth and minusHealth
Fezz-xiii Mar 21, 2021
e6ca280
savepoint
Fezz-xiii Mar 21, 2021
e8b2f35
dmg() runs as expected
Fezz-xiii Apr 2, 2021
cd29ba1
tweaks to dmg
Fezz-xiii Apr 4, 2021
c215c9a
fix dmg, endmg, dodge, working on constitution roll
Fezz-xiii Apr 5, 2021
d18bdbb
testing
Fezz-xiii Apr 16, 2021
78a47c6
combine hero and ememy stats into a singular workable object
Fezz-xiii Jun 15, 2021
a5e1da3
refactor fight function pt 1
Fezz-xiii Jun 15, 2021
5343019
housekeeping
Fezz-xiii Jun 25, 2021
d1174c1
updated readme.md
Rvndyr Jun 25, 2021
350bc26
Merge pull request #1 from Rvndyr/master
jonnicwolf Jun 25, 2021
30926fe
updated readme with instructions on how to install and run
Rvndyr Jun 25, 2021
57a02a7
fixed the 'project setup' in readme
Rvndyr Jun 25, 2021
2e2d783
Merge pull request #2 from Rvndyr/master
jonnicwolf Jun 25, 2021
a4b9bb5
dmg is now attack
Fezz-xiii Jun 26, 2021
bef96ea
bug fixes on dmg.js
Fezz-xiii Jun 26, 2021
5b82471
enDmg refactor
Fezz-xiii Jun 27, 2021
4e8031c
comment out some lines im working on
Fezz-xiii Jun 27, 2021
0fa2ea1
Merge branch 'master' of github.com:jonnicwolf/FSW-Text-Based-Adventure
Fezz-xiii Jun 27, 2021
ee783ee
dmg.js working as expected
Fezz-xiii Jun 27, 2021
6a88680
enemyDmg.js working as expected
Fezz-xiii Jun 27, 2021
7d76525
change ln18+ options[i] to options[index]
Fezz-xiii Jun 28, 2021
0f9ee51
fight.js attack option runs
Fezz-xiii Jun 28, 2021
49c8ead
display cleanup
Fezz-xiii Jun 28, 2021
3fdbed6
housekeeping
Fezz-xiii Jun 28, 2021
fb598fa
reassign character health value ln28 & ln37 @fight.js
Fezz-xiii Jun 29, 2021
fce910c
dmg div constant 150 -> 50 to curb excessive high damage rolls
Fezz-xiii Jul 3, 2021
8c449a3
testing display algo for dialogue + housekeeping
Fezz-xiii Jul 20, 2021
bd88044
start-dialogue @test.js works
Fezz-xiii Aug 19, 2021
235cd80
pickYes/No fixed
Fezz-xiii Aug 19, 2021
de97ac1
minor bug fixes
Fezz-xiii Aug 19, 2021
4bc61ff
delay quest start until showDialogue runs
Fezz-xiii Aug 19, 2021
337006f
place all dialogues in arrays to organise them
Fezz-xiii Aug 19, 2021
73f048e
work on stageOne dialogue && more
Fezz-xiii Aug 26, 2021
11ac98c
levelOne dialogues cleanup
Fezz-xiii Aug 26, 2021
19599d0
aggregate corefunctions for easier imports
Fezz-xiii Aug 27, 2021
e3c0963
dodge refactored
jonnicwolf Oct 7, 2021
ab76865
start working
jonnicwolf Oct 8, 2021
01e1c6a
ln 16 -> switch statement
jonnicwolf Oct 8, 2021
5628e60
connect nameInput to levelone dialogue
jonnicwolf Oct 10, 2021
0da757c
bug fix: hero was undefined
jonnicwolf Oct 10, 2021
19366ef
start working, timing issues fixed
jonnicwolf Oct 11, 2021
e596a1a
file and readme cleanup
jonnicwolf Dec 8, 2021
23b855a
testing on start
jonnicwolf Dec 8, 2021
fca45bb
package.json updates
jonnicwolf Dec 8, 2021
c13dba8
start module now runs
jonnicwolf Dec 8, 2021
ee0bd43
nameInput moved to corefunctions library
jonnicwolf Dec 8, 2021
ba1e47f
typo levelOne lb 17
jonnicwolf Dec 9, 2021
b736c4a
housekeeping
jonnicwolf Dec 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tweaks to dmg
Fezz-xiii committed Apr 4, 2021
commit cd29ba1c118e9d8298d9fb90bd6092240524f2a9
94 changes: 29 additions & 65 deletions DragonRend.js
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@ const quitGame = () => {
let restart = keyInYN('To the well-organised mind, death is but the next great adventure. Restart?')
console.log('Til next time '+ nameInput)
if (restart === true) {
start()
start()
} else if (restart === false) {
console.log('Til next time '+ nameInput)
return
console.log('Til next time '+ nameInput)
process.exit()
}
}

@@ -56,104 +56,68 @@ const constitutionRoll = (passVal, reward, risk) => {
console.log('+--------------------------------------------------------------------------------------+')
console.log(`+ You rolled ${roll}`)
console.log(`+ You gain ${reward} heart points. Health is now ${heroStat.health} +`)

} else if (roll < passVal) {
heroStat.health - risk
console.log('+--------------------------------------------------------------------------------------+')
console.log('+ You rolled ${roll}+')
console.log('+ you lose ${reward} heart points. Health is now ${heroStat.health}+')
return heroStat.health-risk
console.log(`+ you lose ${reward} heart points. Health is now ${heroStat.health}+`)

} else {
console.log('+--------------------------------------------------------------------------------------+')
console.log(`Whoa something went really wrong here`)
}
}

// function addHealth(value, reward, risk) {
// console.log('+--------------------------------------------------------------------------------------+')
// console.log('+ You rolled '+(d6 = dice(6,1))+' ! +')
// if (d6 >= value){
// heroStat[0] = heroStat[0]+reward
// console.log('+--------------------------------------------------------------------------------------+')
// console.log('+ You gain '+reward+' health! +')
// console.log('+ Your health is now '+heroStat[0]+'! +')
// } else if (d6 < value) {
// heroStat[0] = heroStat[0]-risk
// console.log('+--------------------------------------------------------------------------------------+')
// console.log('+ You take '+risk+' damage! +')
// console.log('+ Your health is now '+heroStat[0]+'! +')
// } else {
// console.log('+--------------------------------------------------------------------------------------+')
// console.log('+ Whoa someting went really wrong here!!!!!!! +')
// }

// function minusHealth(value, risk) {
// d6 = dice(6,1)
// if (d6 < value){
// heroStat[0]= heroStat[0]-risk
// }
// console.log('+--------------------------------------------------------------------------------------+')
// console.log('+ You take '+heroStat[0]-risk+' damage! +')
// console.log('+ Your health is now '+heroStat[0]+'. +')
// }

const dmg = (atk, enemyDef, level) => {
const dmg = (atk, enemyDef, level, enemy) => {
const d6Roll = dice(6,1)
const critRoll = dice(3, 1)
console.log(d6Roll, critRoll)
// console.log(d6Roll, critRoll)

let damage = Math.ceil((((2 * level + 10) / 150) * (atk / enemyDef) + 2) * d6Roll)
let critical = Math.ceil((((2 * level + 10) / 150) * (atk / enemyDef) + 2) * critRoll)
console.log(damage, critical)

// console.log(damage, critical)

if (d6Roll !== 1 && d6Roll !== 6) {
console.log('+--------------------------------------------------------------------------------------+')
oppStat.troll.health - damage
console.log(oppStat.troll.health)
console.log('+--------------------------------------------------------------------------------------+')
console.log('normal hit')
return enemy.health - damage

} else if (d6Roll === 6) {
let critDmg = damage + critical
let troll = oppStat.troll.health
troll - critDmg
console.log(critDmg)
console.log(troll)
let troll = enemy.health
console.log('Critical hit!')
return troll - critDmg

} else if (d6Roll === 1) {
console.log(`Your attack missed `)
console.log(`Your attack missed `)
return 0
}
}

// const enDmg = (enemyAtk, def, enemyLvl) = () => {
// const d6 = dice(6, 1)
// const d1 = dice(2, 1)

// let damage = Math.ceil((((2*enemyLvl+10)/150)* (enemyAtk/def)))
// }
const enDmg = (enemyAtk, def, enemyLvl) => {
const d6Roll = dice(6, 1)
const d2Roll = dice(2, 1)

function enDmg(enAtk1, def2, enLvl3) {//enemyArr stat are held in oppStat

d6 = dice (6,1)
d2 = dice (2,1)
let damage = Math.ceil( ( ( (2*enLvl3+10) / 150) * (enAtk1/def2) +2) *d6)
if (d2 === 2) {
let hit = heroStat[0]-damage
let damage = Math.ceil( ( ( (2*enemyLvl+10) / 150) * (enemyAtk/def) +2) *d6Roll)
if (d2Roll === 2) {
let hit = heroStat.health - damage
return hit
} else if (d2 === 1) {
console.log('+ The enemy missed! You take no damage. +')
return 0
}
}

function dodge(risk,enAtk1,def2,){//if dodge roll is > 3, nullify damage
d6 = dice(6,1)
const dodge = (risk,enemyAtk,def) => {//if dodge roll is > 3, nullify damage
const d6 = dice(6,1)
if (d6 > 3){
console.log('+ Succesful dodge! +')
enDmg(enAtk1,def2,enlvl3)
} else if (d6 < 4) {
console.log('+ Succesful dodge! +')
return 1;

dodgeFail = heroStat[0]-risk
} else if (d6 < 4) {
console.log('+ You tripped during your dodge and took '+risk+' damage! +')
console.log('+ Your health is now '+heroStat.health+'! +')
console.log(`+ Your health is now ${heroStat.health}! +`)
}
}