From c8ae66c39062730781fb9279d255e9631cb84969 Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Thu, 29 Jul 2021 00:00:54 +0900 Subject: [PATCH] Implemented part of a damage calculator. Minor style changes. Co-authored-by: dudleycu --- src/App.js | 114 +++++++++++++++++++++++++++++++++++++++++++++++--- src/style.css | 23 ++++++++++ 2 files changed, 131 insertions(+), 6 deletions(-) diff --git a/src/App.js b/src/App.js index 3ba46f6..dd82373 100644 --- a/src/App.js +++ b/src/App.js @@ -31,7 +31,9 @@ function Col(p) { function Box(p) { return <>
-

♦ {p.title}

+
+

{p.title}

+
{p.children}
@@ -194,11 +196,11 @@ function EditableClass(p){ } function Table(p) { - return - + return

+ {p.children} -

-
+ +

} function MainBox(p) { @@ -502,7 +504,7 @@ function TableEditor(p) { function AdminPanel(p) { return
- +
Class
Class Data
Class-Weapon Compatibility
@@ -593,6 +595,103 @@ function AdminPanel(p) { } +function EditStatBox(p) { + + const [value,setValue] = useState(p.value) + + return <>{setValue(f.currentTarget.value);p.callback(f.currentTarget.value)}}/> ({value})
+} + +function DamageCalculator(p) { + + const [augmentData,setAugmentData] = useState({}) + const [update,setUpdate] = useState(false) + + useEffect(()=>{ + axios.get(BACKEND_URL+"/augments") + .then((data)=>{ + var augmentData = {} + data.data.rows.forEach((entry)=>{augmentData[entry.id]=entry}) + setAugmentData(augmentData) + }) + },[update]) + + const character = { + weapon:{ + augments:[7,2,5] + }, + armor1:{ + augments:[1,5] + }, + armor2:{ + augments:[2,8] + }, + armor3:{ + augments:[4,1] + } + } + + function ParseAugments(equip) { + var variance_total = 0 + for (var i=0;i{ + setWeaponTotalAtk(weaponBaseAtk+weaponEnhanceLvl) + },[weaponBaseAtk,weaponEnhanceLvl]) + + const [dmgVariance,setDmgVariance] = useState(1) + + const [weaponDmgVariance,setWeaponDmgVariance] = useState(1) + const [augDmgVariance,setAugDmgVariance] = useState(1) + + useEffect(()=>{ + setDmgVariance(weaponDmgVariance+augDmgVariance) + },[weaponDmgVariance,augDmgVariance]) + + const [baseAtk,setBaseAtk] = useState(100) + const [enemyDef,setEnemyDef] = useState(5) + const [multipliers,setMultipliers] = useState(1) + + useEffect(()=>{ + setRawDmg(((weaponTotalAtk*dmgVariance)+baseAtk-enemyDef)*multipliers/5) + },[weaponTotalAtk,dmgVariance,baseAtk,enemyDef,multipliers]) + + return <> +
+ Weapon Total Atk:{setWeaponTotalAtk(val)}}/> +
    +
  • ●Weapon Base Atk:{setWeaponBaseAtk(val)}}/>
  • +
  • ●Weapon Enhance Lvl:{setWeaponEnhanceLvl(val)}}/>
  • +
+


+ Damage Variance:{setDmgVariance(val)}}/> +
    +
  • ●Weapon Damage Variance:{setWeaponDmgVariance(val)}}/>
  • +
  • ●Augment Damage Variance:{setAugDmgVariance(val)}}/>
  • +
+


+ Base Attack:{setBaseAtk(val)}}/> + Enemy Defense:{setEnemyDef(val)}}/> + Multipliers:{setMultipliers(val)}}/> +


+ Raw Dmg:{rawDmg} +
+ +} + function App() { const [author,setAuthor] = useState("Dudley") @@ -662,6 +761,9 @@ function App() {
+ + +
diff --git a/src/style.css b/src/style.css index 8980f36..b9b9d12 100644 --- a/src/style.css +++ b/src/style.css @@ -20,6 +20,18 @@ font-family: "ngs4"; src: url("./fonts/1.woff") format("woff"); } +a, a:visited { + color: white; + text-decoration: none; +} +a:hover, a:active { + color: white; + text-decoration: none; + background-color: rgba(113,169,189,0.33); +} +hr { + border-bottom: 1px solid rgba(128,128,128,0.5); +} img { vertical-align: middle; } @@ -919,4 +931,15 @@ button{ .submitbutton:hover{ color:rgba(0,200,0,1); cursor:pointer; +} + +/* Admin Panel */ + +.adminNav { + font-size: 12pt; + line-height: 1.5em; +} +p.adminNav hr { + border-bottom: 1px solid white; + margin: 10px 0; } \ No newline at end of file