2013-07-29 11:13:03 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ItemHandler.h"
|
2020-04-03 06:57:01 +00:00
|
|
|
#include "../BlockInfo.h"
|
2013-07-29 11:13:03 +00:00
|
|
|
|
2013-08-19 09:39:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-13 16:38:06 +00:00
|
|
|
class cItemSwordHandler:
|
2013-08-19 09:39:13 +00:00
|
|
|
public cItemHandler
|
2013-07-29 11:13:03 +00:00
|
|
|
{
|
2020-04-13 16:38:06 +00:00
|
|
|
using Super = cItemHandler;
|
|
|
|
|
2013-07-29 11:13:03 +00:00
|
|
|
public:
|
2020-04-13 16:38:06 +00:00
|
|
|
|
2020-04-03 06:57:01 +00:00
|
|
|
cItemSwordHandler(int a_ItemType):
|
2020-04-13 16:38:06 +00:00
|
|
|
Super(a_ItemType)
|
2013-07-29 11:13:03 +00:00
|
|
|
{
|
|
|
|
}
|
2014-07-23 14:32:09 +00:00
|
|
|
|
|
|
|
|
2013-07-29 11:13:03 +00:00
|
|
|
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
|
|
|
{
|
2014-07-26 11:23:11 +00:00
|
|
|
if (a_BlockType == E_BLOCK_COBWEB)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2020-04-13 16:38:06 +00:00
|
|
|
return Super::CanHarvestBlock(a_BlockType);
|
2013-07-29 11:13:03 +00:00
|
|
|
}
|
2014-04-30 22:47:57 +00:00
|
|
|
|
2014-07-23 14:32:09 +00:00
|
|
|
|
2014-05-06 17:38:09 +00:00
|
|
|
virtual bool CanRepairWithRawMaterial(short a_ItemType) override
|
2014-04-30 22:47:57 +00:00
|
|
|
{
|
|
|
|
switch (m_ItemType)
|
|
|
|
{
|
2014-05-06 17:38:09 +00: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 22:47:57 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2014-07-23 14:32:09 +00:00
|
|
|
|
|
|
|
|
2014-07-26 11:26:14 +00:00
|
|
|
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override
|
2014-07-23 14:32:09 +00:00
|
|
|
{
|
2015-07-29 15:04:03 +00:00
|
|
|
switch (a_Action)
|
2014-07-23 14:32:09 +00:00
|
|
|
{
|
2018-01-05 11:28:06 +00:00
|
|
|
case dlaAttackEntity: return 1;
|
|
|
|
case dlaBreakBlock: return 2;
|
|
|
|
case dlaBreakBlockInstant: return 0;
|
2014-07-23 14:32:09 +00:00
|
|
|
}
|
2018-02-04 23:07:12 +00:00
|
|
|
UNREACHABLE("Unsupported durability loss action");
|
2014-07-23 14:32:09 +00:00
|
|
|
}
|
2016-11-06 18:30:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-11-13 15:21:30 +00:00
|
|
|
virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) override
|
2016-11-06 18:30:19 +00: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 09:39:13 +00:00
|
|
|
} ;
|