feat: remove body-part targeting
authorxangelo <me@xangelo.ca>
Tue, 5 Sep 2023 19:37:32 +0000 (15:37 -0400)
committerxangelo <me@xangelo.ca>
Tue, 5 Sep 2023 19:37:32 +0000 (15:37 -0400)
The body part targeting stopped working once we moved over to the new
vigor system ,but the UI was left in just in case.

src/server/api.ts
src/server/fight.ts
src/server/views/fight.ts

index 7428e79ddaebd1d50ddf380ec7f2a6408b19eae0..80aa82af1b4649f7dacfc2d639a57d5274e0f45f 100644 (file)
@@ -609,8 +609,7 @@ app.post('/fight/turn', authEndpoint, async (req: Request, res: Response) => {
   }
 
   const fightData  = await fightRound(req.player, monster, {
-    action: req.body.action,
-    target: req.body.fightTarget
+    action: req.body.action
   });
 
 
index ab7b2c6b497b9bdf9c485912c100719efc3b5c9e..011cc5c667dfa27a4f4f90035b94aa545a675aa5 100644 (file)
@@ -35,7 +35,7 @@ function exponentialExp(exp: number, monsterLevel: number, playerLevel: number):
   return Math.floor(finalExp);
 }
 
-export async function fightRound(player: Player, monster: Fight,  data: {action: 'attack' | 'cast' | 'flee', target: 'head' | 'body' | 'arms' | 'legs'}) {
+export async function fightRound(player: Player, monster: Fight,  data: {action: 'attack' | 'cast' | 'flee'}) {
   const playerSkills = await getPlayerSkillsAsObject(player.id);
   const roundData: FightRound = {
     monster,
index b3ba986f9df286ff02f0272c4d0b814a3f7dcd47..b89f32e2423887fa8d53307d3a532e13ac8e40a1 100644 (file)
@@ -86,12 +86,6 @@ export function renderFight(monster: Fight, results: string = '', displayFightAc
     <div id="fight-actions">
       ${displayFightActions ? `
       <form hx-post="/fight/turn" hx-target="#fight-container">
-        <select id="fight-target" name="fightTarget">
-          <option value="head">Head</option>
-          <option value="body">Body</option>
-          <option value="arms">Arms</option>
-          <option value="legs">Legs</option>
-        </select>
         ${AttackButton(blockTime)}
         ${CastButton(blockTime)}
         <button type="submit" class="fight-action" name="action" value="flee">Flee</button>
@@ -106,8 +100,6 @@ export function renderFight(monster: Fight, results: string = '', displayFightAc
 }
 
 export function renderFightPreRound(monster: Fight,  displayFightActions: boolean = true, location: LocationWithCity, closestTown: number) {
-  const hpPercent = Math.floor((monster.hp / monster.maxHp) * 100);
-
   let html = `
 <section id="explore" class="tab active" style="background-image: url('/assets/img/map/${closestTown}.jpeg')" hx-swap-oob="true">
   <div class="city-title-wrapper">
@@ -116,34 +108,8 @@ export function renderFightPreRound(monster: Fight,  displayFightActions: boolea
   <div class="city-details">
     <h3 class="location-name"><span>${location.name}</span></h3>
 
-  <div id="fight-container">
-    <div id="defender-info">
-      <div class="avatar-container">
-        <img id="avatar" src="https://via.placeholder.com/64x64">
-      </div>
-      <div id="defender-stat-bars">
-        <div id="defender-name">${monster.name}, level ${monster.level}</div>
-        <div class="progress-bar" id="defender-hp-bar" style="background: linear-gradient(to right, red, red ${hpPercent}%, transparent ${hpPercent}%, transparent)" title="${hpPercent}% - ${monster.hp}/${monster.maxHp}">${hpPercent}% - ${monster.hp} / ${monster.maxHp}</div>
-      </div>
-    </div>
-    <div id="fight-actions">
-      ${displayFightActions ? `
-      <form hx-post="/fight/turn" hx-target="#fight-container">
-        <select id="fight-target" name="fightTarget">
-          <option value="head">Head</option>
-          <option value="body">Body</option>
-          <option value="arms">Arms</option>
-          <option value="legs">Legs</option>
-        </select>
-        ${AttackButton()}
-        ${CastButton()}
-        <button type="submit" class="fight-action" name="action" value="flee">Flee</button>
-      </form>
-      `: ''}
-      </div>
-    <div id="fight-results"></div>
+    ${renderFight(monster, '', displayFightActions)}
   </div>
-</div>
 </section>
 `;