projectiles

This commit is contained in:
dingo
2026-01-18 00:17:06 -05:00
parent 4e189613fb
commit 6e14f6faa1
17 changed files with 4981 additions and 51 deletions
+69
View File
@@ -203,6 +203,73 @@
</div>
</div>
<!-- Projectile/Ranged Weapon Properties -->
<div id="projectileSection" class="card" style="display: @(isWeapon ? "block" : "none")">
<div class="p-4 border-b border-gray-700">
<h2 class="text-lg font-semibold text-white">Projectile & Ranged Weapon Properties</h2>
<p class="text-sm text-gray-400 mt-1">Configuration for bows, crossbows, and throwable weapons</p>
</div>
<div class="p-6 space-y-6">
<!-- Basic Projectile Settings -->
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="flex items-center pt-6">
<label class="flex items-center gap-2 cursor-pointer">
<input type="checkbox" id="requiresAmmoCheck" name="Item.RequiresAmmunition" value="true" checked="@Model.Item.RequiresAmmunition" class="w-4 h-4 rounded border-gray-600 bg-gray-800 text-indigo-600" onchange="toggleAmmoFields()" />
<span class="text-gray-300">Requires Ammunition</span>
</label>
</div>
<div class="flex items-center pt-6">
<label class="flex items-center gap-2 cursor-pointer">
<input type="checkbox" name="Item.IsThrowable" value="true" checked="@Model.Item.IsThrowable" class="w-4 h-4 rounded border-gray-600 bg-gray-800 text-indigo-600" />
<span class="text-gray-300">Is Throwable</span>
</label>
</div>
</div>
<!-- Ammunition Type -->
<div id="ammoTypeSection" style="display: @(Model.Item.RequiresAmmunition ? "block" : "none")">
<label class="label">Ammunition Type</label>
<input type="text" name="Item.AmmunitionType" value="@Model.Item.AmmunitionType" class="input" maxlength="32" placeholder="e.g., arrow, bolt" />
<p class="text-xs text-gray-500 mt-1">Must match the AmmunitionType of ammo items (e.g., "arrow" for bows, "bolt" for crossbows)</p>
</div>
<!-- Projectile Physics -->
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div>
<label class="label">Projectile Speed (px/s)</label>
<input type="number" name="Item.ProjectileSpeed" value="@Model.Item.ProjectileSpeed" class="input" min="0" step="1" />
<p class="text-xs text-gray-500 mt-1">0 = melee only</p>
</div>
<div>
<label class="label">Max Range (pixels)</label>
<input type="number" name="Item.ProjectileRange" value="@Model.Item.ProjectileRange" class="input" min="0" step="1" />
<p class="text-xs text-gray-500 mt-1">Distance before projectile expires</p>
</div>
<div>
<label class="label">Recovery Chance (%)</label>
<input type="number" name="Item.ArrowRecoveryChance" value="@((Model.Item.ArrowRecoveryChance * 100).ToString("0.##"))" class="input" min="0" max="100" step="0.1" oninput="this.form.elements['Item.ArrowRecoveryChance'].value = this.value / 100" />
<input type="hidden" name="Item.ArrowRecoveryChance" value="@Model.Item.ArrowRecoveryChance" />
<p class="text-xs text-gray-500 mt-1">Chance to recover ammo after hit (for ammunition items)</p>
</div>
<div>
<label class="label">Quiver Capacity</label>
<input type="number" name="Item.QuiverCapacity" value="@Model.Item.QuiverCapacity" class="input" min="0" max="10" />
<p class="text-xs text-gray-500 mt-1">Number of ammo slots (0 = not a quiver container)</p>
</div>
</div>
<div class="bg-blue-900/20 border border-blue-700 rounded-lg p-4 text-sm text-blue-200">
<strong>Weapon Types:</strong>
<ul class="mt-2 space-y-1 ml-4">
<li><strong>Bows/Crossbows:</strong> Enable "Requires Ammunition", set AmmunitionType, ProjectileSpeed, Range</li>
<li><strong>Throwables (knives, javelins):</strong> Enable "Is Throwable", set ProjectileSpeed, Range (no ammo required - consumes from inventory)</li>
<li><strong>Quiver Containers:</strong> Set QuiverCapacity > 0, equip to Quiver slot</li>
<li><strong>Ammunition (arrows, bolts):</strong> Set Recovery Chance, make Stackable, set EquipSlot to Quiver</li>
</ul>
</div>
</div>
</div>
<!-- Resistances (Equipment) -->
<div id="resistancesSection" class="card" style="display: @(isEquipment ? "block" : "none")">
<div class="p-4 border-b border-gray-700">
@@ -292,6 +359,7 @@
else { img.classList.add('hidden'); placeholder.classList.remove('hidden'); }
}
function toggleMaxStack() { const cb = document.getElementById('stackableCheck'); const input = document.getElementById('maxStackInput'); input.disabled = !cb.checked; if (!cb.checked) input.value = 1; }
function toggleAmmoFields() { const cb = document.getElementById('requiresAmmoCheck'); const section = document.getElementById('ammoTypeSection'); section.style.display = cb.checked ? 'block' : 'none'; }
function updateSections() {
const type = document.getElementById('itemType').value;
const isEquipment = ['Weapon', 'Armor', 'Accessory'].includes(type);
@@ -308,6 +376,7 @@
document.getElementById('damageTypeSection').style.display = isWeapon ? 'block' : 'none';
document.getElementById('minDamageRangeSection').style.display = isWeapon ? 'block' : 'none';
document.getElementById('maxDamageRangeSection').style.display = isWeapon ? 'block' : 'none';
document.getElementById('projectileSection').style.display = isWeapon ? 'block' : 'none';
document.getElementById('consumableSection').style.display = isConsumable ? 'block' : 'none';
}
function addResistance() {
@@ -211,7 +211,7 @@
<div class="card p-4">
<h2 class="text-md font-semibold text-white mb-3">Equipment</h2>
<div class="space-y-1">
@foreach (var slot in new[] {
@foreach (var slot in new[] {
(DungeonEquipmentSlot.MainHand, "Weapon"),
(DungeonEquipmentSlot.OffHand, "Off-Hand"),
(DungeonEquipmentSlot.Head, "Head"),
@@ -219,8 +219,10 @@
(DungeonEquipmentSlot.Legs, "Legs"),
(DungeonEquipmentSlot.Boots, "Boots"),
(DungeonEquipmentSlot.Gloves, "Gloves"),
(DungeonEquipmentSlot.Accessory1, "Accessory 1"),
(DungeonEquipmentSlot.Accessory2, "Accessory 2")
(DungeonEquipmentSlot.Necklace, "Necklace"),
(DungeonEquipmentSlot.Ring1, "Ring 1"),
(DungeonEquipmentSlot.Ring2, "Ring 2"),
(DungeonEquipmentSlot.Quiver, "Quiver")
})
{
var item = Model.EquippedItems.FirstOrDefault(i => i.EquipSlot == slot.Item1);
+9 -1
View File
@@ -133,7 +133,15 @@
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
<span>Loot Tables</span>
</a>
<a href="/admin/resistances" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Resistances") == true ? "active" : "")" data-tooltip="Resistances">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/></svg>
<span>Resistances</span>
</a>
<a href="/admin/abilities" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Abilities") == true ? "active" : "")" data-tooltip="Abilities">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>
<span>Abilities</span>
</a>
<p class="section-title px-3 pt-3 pb-1 text-xs font-semibold text-gray-500 uppercase">Management</p>
<a href="/admin/dungeons" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Dungeons") == true ? "active" : "")" data-tooltip="Dungeons">