#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()
{
}