2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ItemHandler.h"
|
2020-04-03 02:57:01 -04:00
|
|
|
#include "../BlockInfo.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
2013-08-19 05:39:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
class cItemSwordHandler:
|
2013-08-19 05:39:13 -04:00
|
|
|
public cItemHandler
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
using Super = cItemHandler;
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
2020-04-13 12:38:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
cItemSwordHandler(int a_ItemType):
|
2020-04-13 12:38:06 -04:00
|
|
|
Super(a_ItemType)
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
|
|
|
}
|
2014-07-23 10:32:09 -04:00
|
|
|
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
|
|
|
{
|
2014-07-26 07:23:11 -04:00
|
|
|
if (a_BlockType == E_BLOCK_COBWEB)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2020-04-13 12:38:06 -04:00
|
|
|
return Super::CanHarvestBlock(a_BlockType);
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
2014-04-30 18:47:57 -04:00
|
|
|
|
2014-07-23 10:32:09 -04:00
|
|
|
|
2014-05-06 13:38:09 -04:00
|
|
|
virtual bool CanRepairWithRawMaterial(short a_ItemType) override
|
2014-04-30 18:47:57 -04:00
|
|
|
{
|
|
|
|
switch (m_ItemType)
|
|
|
|
{
|
2014-05-06 13:38:09 -04:00
|
|
|
case E_ITEM_WOODEN_SWORD: return (a_ItemType == E_BLOCK_PLANKS);
|
|
|
|
case E_ITEM_STONE_SWORD: return (a_ItemType == E_BLOCK_COBBLESTONE);
|
|
|
|
case E_ITEM_IRON_SWORD: return (a_ItemType == E_ITEM_IRON);
|
|
|
|
case E_ITEM_GOLD_SWORD: return (a_ItemType == E_ITEM_GOLD);
|
|
|
|
case E_ITEM_DIAMOND_SWORD: return (a_ItemType == E_ITEM_DIAMOND);
|
2014-04-30 18:47:57 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2014-07-23 10:32:09 -04:00
|
|
|
|
|
|
|
|
2014-07-26 07:26:14 -04:00
|
|
|
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override
|
2014-07-23 10:32:09 -04:00
|
|
|
{
|
2015-07-29 11:04:03 -04:00
|
|
|
switch (a_Action)
|
2014-07-23 10:32:09 -04:00
|
|
|
{
|
2018-01-05 06:28:06 -05:00
|
|
|
case dlaAttackEntity: return 1;
|
|
|
|
case dlaBreakBlock: return 2;
|
|
|
|
case dlaBreakBlockInstant: return 0;
|
2014-07-23 10:32:09 -04:00
|
|
|
}
|
2018-02-04 18:07:12 -05:00
|
|
|
UNREACHABLE("Unsupported durability loss action");
|
2014-07-23 10:32:09 -04:00
|
|
|
}
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-11-13 10:21:30 -05:00
|
|
|
virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) override
|
2016-11-06 13:30:19 -05:00
|
|
|
{
|
|
|
|
if (a_Block == E_BLOCK_COBWEB)
|
|
|
|
{
|
|
|
|
return 15.0f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (
|
|
|
|
IsBlockMaterialPlants(a_Block) ||
|
|
|
|
IsBlockMaterialVine(a_Block) ||
|
|
|
|
IsBlockMaterialLeaves(a_Block) ||
|
|
|
|
IsBlockMaterialGourd(a_Block)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return 1.5f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 1.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-19 05:39:13 -04:00
|
|
|
} ;
|