2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ItemHandler.h"
|
|
|
|
#include "../World.h"
|
2013-08-19 05:39:13 -04:00
|
|
|
#include "../Entities/Player.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
2013-08-19 05:39:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cItemSwordHandler :
|
|
|
|
public cItemHandler
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2014-07-23 10:32:09 -04:00
|
|
|
typedef cItemHandler super;
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
|
|
|
cItemSwordHandler(int a_ItemType)
|
|
|
|
: cItemHandler(a_ItemType)
|
|
|
|
{
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
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
|
|
|
{
|
|
|
|
case dlaAttackEntity: return 1;
|
|
|
|
case dlaBreakBlock: return 2;
|
|
|
|
}
|
2015-07-29 11:04:03 -04:00
|
|
|
|
|
|
|
#ifndef __clang__
|
2014-07-23 10:32:09 -04:00
|
|
|
return 0;
|
2015-07-29 11:04:03 -04:00
|
|
|
#endif
|
2014-07-23 10:32:09 -04:00
|
|
|
}
|
2013-08-19 05:39:13 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|