スキルC++1

6593 ワード

#pragma once
#include "..//App_Module//App_Server.h"

#define CLIENT_OPERATE() App_Server::get_log_trace()->print( Module_Name::Game_App, _T("      ") )

#define SERVER_OPERATE() App_Server::get_log_trace()->print( Module_Name::Game_App, _T("      ") )

CString l2s(long _num);
CString d2s(double _num);
//    
void target_play_sound(long _uid, const TCHAR* _sound_file_name, double _delay_time);
//    
long create_entity_targer( long _uid, long _world_uid, long _x, long _y );
//    
void destroy_entity( long _uid );
//  
void add_mana( long _uid, long _val );
//    
bool Is_Hero( long _uid );
//    
void show_chat_tips( long _uid, TCHAR* _skill );
//  
void unit_damage_unit( long _caster_uid, long _target_uid, long _val );
//    
bool is_dead( long _target_uid );
//     
void stun_unit(long _target_uid, long state );

 
#include "stdafx.h"
#include "Game_API.h"



CString l2s(long _num)
{
	CString ret;
	ret.Format(_T("%d"), _num);
	return ret;
}

CString d2s(double _num)
{
	CString ret;
	ret.Format(_T("%0.9f"), _num);
	return ret;
}

//    
void target_play_sound(long _uid, const TCHAR* _sound_file_name, double _delay_time)
{
	CString text;
	text.Format(_T("%d      %0.9f        %s"), _uid, _delay_time, _sound_file_name);
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}

//    
long create_entity_targer( long _uid, long _world_uid, long _x, long _y )
{
	CString text;
	text.Format( _T("%d      <%d, %d, %d>  ,      "), _uid, _world_uid, _x, _y );
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
	return _uid;
}

//    
void destroy_entity( long _uid )
{
	CString text;
	text.Format( _T("%d     ,      "), _uid );
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}

//  
void add_mana( long _uid, long _val )
{
	CString text;
	text.Format( _T("%d      %d"), _uid, _val );
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}

//    
bool Is_Hero( long _uid )
{
	CString text;
	text.Format( _T("%d     "), _uid);
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
	return true;
}

//    
void show_chat_tips( long _uid, TCHAR* _skill )
{
	CString text;
	text.Format( _T("   %d      %s   "), _uid, _skill );
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}

//  
void unit_damage_unit( long _caster_uid, long _target_uid, long _val )
{
	CString text;
	text.Format( _T("%d      %d,      %d "), _caster_uid, _target_uid, _val );
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}

//    
bool is_dead( long _target_uid )
{
	CString text;
	text.Format( _T("%d       "), _target_uid );
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
	return false;
}

//     
void stun_unit(long _target_uid, long state )
{
	CString text;
	text.Format( _T("%d        %d "), _target_uid, state );
	App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}

 
#pragma once
#include "..//Game_Module//Proxy_Factory.h"
#include "..//Game_Module//Delete_Proxy.h"

using namespace std;

struct SKILL_ID
{
	enum SKILL 
	{
		LXTX	=	1,	//    
		MFX		=	2,	//   
	};
};

struct CLIENT_NAME{};
typedef Proxy_Factory< CLIENT_NAME, Delete_Proxy, Delete_Proxy >			CLIENT_DELETE_SERVER;

 
#pragma once

#include "Game_Skill_define.h"



struct IClient_Skill
{
	IClient_Skill()
	{ 
		CLIENT_DELETE_SERVER::get_proxy()->push_single(this); 
	}
	virtual ~IClient_Skill()
	{
		CLIENT_DELETE_SERVER::get_proxy()->pop(this); 
	} 
	virtual void SpellEff() = 0;
};

template<long> 
struct Client_Skill: public IClient_Skill{};

/*
    
*/
template<>
struct Client_Skill<SKILL_ID::LXTX>: public IClient_Skill{ void SpellEff(); };

/*
   
   :C            ,    ,   1.75 。    :500    :10 
    :95/110/125/140 
   1 -   100    。
   2 -   175    。
   3 -   250    。
   4 -   325    。
*/
template<>
struct Client_Skill<SKILL_ID::MFX>: public IClient_Skill{ void SpellEff(); };

 
#include "stdafx.h"
#include "Game_Skill_Client.h"
#include "Game_API.h"





/*
    
*/
void Client_Skill<SKILL_ID::LXTX>::SpellEff()
{
	CLIENT_OPERATE();
	long caster_uid = 135;
	long target_uid = 137;
	long skill_uid = 1008;
	target_play_sound(0, _T("MFX"), 0.11);
	App_Server::get_log_trace()->print( Module_Name::Game_App, _T("     ") );
	bool no_spell_block = true;
	if ( no_spell_block )	
	{
		//        
		destroy_entity(  create_entity_targer(skill_uid, 1084, 32, 79) );
		//   
		add_mana(target_uid, -20);
		if( Is_Hero(target_uid) )
		{
			show_chat_tips( target_uid, _T("    ") );
		}

		//    
		unit_damage_unit( caster_uid, target_uid, 50 );
		if( !is_dead( target_uid ) )
		{
			stun_unit( target_uid, 1111 );
		}
	}
	delete this;
}

/*
   
   :C            ,    ,   1.75 。    :500    :10 
    :95/110/125/140 
   1 -   100    。
   2 -   175    。
   3 -   250    。
   4 -   325    。
*/
void Client_Skill<SKILL_ID::MFX>::SpellEff()
{
}