Скакун: сфера и камень ставятся шифт-кликом
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d35b77be1b
commit
dec5d9851d
@@ -264,6 +264,42 @@ namespace NecromancerTome
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Шифт-клик сферой или камнем в окне скакуна (01.10: «в оссуарий сфера вставляется
|
||||
/// по шифт-клику, а в мотоцикл только перетаскиванием»). Ваниль ставит деталь шифт-кликом
|
||||
/// через AddPartToItem, а он пускает модификацию только по InstallableTags хозяина - у сферы
|
||||
/// и камня там браслет. Для скакуна - первая пустая ячейка, как у ванили.</summary>
|
||||
[HarmonyPatch(typeof(XUiM_AssembleItem), nameof(XUiM_AssembleItem.AddPartToItem))]
|
||||
public static class Patch_XUiM_AssembleItem_AddPartToItem_BoneSteed
|
||||
{
|
||||
public static bool Prefix(XUiM_AssembleItem __instance, ItemStack _partStack, out ItemStack _resultStack, ref bool __result)
|
||||
{
|
||||
_resultStack = _partStack;
|
||||
ItemStack current = __instance.CurrentItem;
|
||||
if (current == null || current.IsEmpty() || !BoneSteedFuel.IsSteedItem(current.itemValue))
|
||||
return true;
|
||||
__result = false;
|
||||
ItemValue add = _partStack.itemValue;
|
||||
bool blood = BoneSteedFuel.IsStone(add) ||
|
||||
BoneSteedFuel.IsSphere(add) && add.UseTimes < add.MaxUseTimes;
|
||||
if (!blood)
|
||||
return false;
|
||||
ItemValue item = current.itemValue;
|
||||
for (int i = 0; i < item.ModificationCount; i++)
|
||||
{
|
||||
ItemValue m = item.GetModification(i);
|
||||
if (m != null && !m.IsEmpty())
|
||||
continue;
|
||||
item.SetModification(i, add.Clone());
|
||||
__instance.RefreshAssembleItem();
|
||||
__instance.UpdateAssembleWindow();
|
||||
_resultStack = ItemStack.Empty;
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Здоровье скакуна не зависит от сфер в ячейках (у сферы DegradationMax 500).</summary>
|
||||
[HarmonyPatch(typeof(ItemValue), nameof(ItemValue.MaxUseTimesBase), MethodType.Getter)]
|
||||
public static class Patch_ItemValue_MaxUseTimesBase_BoneSteed
|
||||
|
||||
Reference in New Issue
Block a user