
#define OAF_WAIT 1
#define OAF_WALK 2
#define OAF_ATTACK 4
#define OAF_DEFENSE 8
#define OAF_PAIN 0x10
#define OAF_DEATH 0x20
#define OAF_WIN 0x40
#define OAF_ATTACK2 0x800
#define OAF_ATTACK3 0x1000
#define OAF_ATTACK4 0x2000
#define OAF_ATTACK5 0x4000
#define OAF_SPELL1 0x8000
#define OAF_SPELL2 0x10000
#define OAF_SHOT1 0x20000
#define OAF_SHOT2 0x40000
#define OAF_SHOT3 0x80000
#define OAF_ATTACK6 0x100000
#define OAF_ATTACK7 0x200000
#define OAF_ATTACK8 0x400000
#define OF_MAN 0x00000001
#define OF_MISSILE 0x00000002
#define OF_BACKGROUND 0x00000004
#define OF_CAVALRY 0x00000008
#define OF_BLOCKMAN 0x00000010
#define OF_BLOCKMISSILE 0x00000020
#define OF_BIGSHAPE 0x00000040
#define OF_TRIGGERMAN 0x00000100
#define OF_TRIGGERMISSILE 0x00000200
#define OF_NOGRAVITY 0x00010000
#define OF_NONSYNCHRONISM 0x00020000
#define OF_MIXER 0x00040000
#define OF_WHITELIGHT 0x00080000
#define OF_DARKLIGHT 0x00100000
#define OF_TARGET 0x00200000
#define OF_BOMB 0x00400000
#define OF_ENEMYGENERAL 0x01000000
#define OF_ENEMYFORCE 0x02000000
#define OF_ATTACKENEMY 0x03000000
#define OF_MYGENERAL 0x04000000
#define OF_MYFORCE 0x08000000
#define OF_ATTACKMY 0x0c000000
#define OF_ATTACKALL 0x0F000000
// 召唤铁锅
void CastFail(int a0, int a1) {
int v1;
v1 = CreateObjectByReference(a0, 10017, a1, 256);
SetObjectFlags(v1, OF_MYGENERAL);
SetCallbackProcedure(v1, 1000);
SetObjectAnimate(a0, OAF_SPELL1);
SetOverwhelming(a0, 0);
Delay(60);
return;
}
void DelayAmbientSound(string a0, int a1, int a2) {
SetGlobal(1, 1);
PlaySound1(a0, a1);
Delay(a2);
SetGlobal(1, 0);
return;
}
// 摄像机移过去
void MoveCamera(int a0, int a1, int a2) {
int v1;
int v2;
int v3;
int v4;
int v5;
v2 = (GetCameraX() * 1000);
v3 = (GetCameraY() * 1000);
a0 = (a0 * 1000);
a1 = (a1 * 1000);
v4 = (a0 - v2);
v4 = (v4 / a2);
v5 = (a1 - v3);
v5 = (v5 / a2);
v1 = a2;
while ((v1 > 0)) {
v2 = (v2 + v4);
v3 = (v3 + v5);
SetViewCamera((v2 / 1000), (v3 / 1000));
if (((v2 / 100) == (a0 / 100)) && ((v3 / 100) == (a1 / 100))) {
v1 = 1;
}
v1--;
Delay(1);
}
return;
}
// 让天空变黑
void DownBrightness(int a0, int a1) {
int v1;
v1 = GetBackgroundBrightness();
while ((v1 > a0)) {
Delay(a1);
v1--;
SetBackgroundBrightness(v1);
}
SetBackgroundBrightness(16);
LockBrightness(a0);
SetGlobal(2, a0);
return;
}
// 天空渐渐变白
void RaiseBrightness(int a0, int a1) {
int v1;
UnlockBrightness();
v1 = GetGlobal(2);
SetBackgroundBrightness(v1);
while ((v1 < a0)) {
Delay(a1);
v1++;
SetBackgroundBrightness(v1);
}
SetBackgroundBrightness(a0);
return;
}
// 镜头锁定物件
void LockCameraOnObject(int object, int yOffset) {
int dir = GetObjectDir(object);
while(IsObjectExist(object)) {
// 得到欲锁定物件和摄像机自身的x坐标
int objectX = GetObjectScreenX(object);
int cameraX = GetCameraX();
// 检查边界:如果飞出战场,则直接退出
if (cameraX < 0 || cameraX >= GetBattleWidthInScreenX())
break;
// 检查物件与摄像机的距离
int dx = objectX - cameraX;
// 如果物件正在飞离摄像机,则移动摄像机,否则什么也不做
if ((dir == 0 && dx > 0) || (dir == 128 && dx < 0))
SetCameraByReference(object, 0, yOffset);
Delay(1);
}
}
void SmallFireBall(int a0, int a1, int a2, int a3) {
int v1;
int v2;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10003, Rand(0, 255), a3);
SetObjectScale(v1, 12288, 12288);
SetObjectSpeed_Cylind(v1, Rand(4, 12), Rand((-2), 8));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void SmallFireBall2(int a0, int a1, int a2, int a3) {
int v1;
int v2;
int v3;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10003, Rand(0, 255), a3);
v3 = Rand(8192, 12288);
SetObjectScale(v1, v3, v3);
SetObjectSpeed_Cylind(v1, Rand(3, 7), Rand((-1), 5));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void SmallFireBall3(int a0, int a1, int a2, int a3) {
int v1;
int v2;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10013, Rand(0, 255), a3);
SetObjectScale(v1, 12288, 12288);
SetObjectSpeed_Cylind(v1, Rand(4, 12), Rand((-2), 8));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void SmallFireBall4(int a0, int a1, int a2, int a3) {
int v1;
int v2;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10014, Rand(0, 255), a3);
SetObjectScale(v1, 12288, 12288);
SetObjectSpeed_Cylind(v1, Rand(4, 12), Rand((-2), 8));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void Hurt(int a0, int a1, int a2) {
if (!((a1 == intvAttackerMajor) || (a1 == intvDefenderMajor))) {
PlaySound(a1, "Hit01", 255);
} else {
ClearObjectFlags(a0, (OF_MYGENERAL + OF_ENEMYGENERAL));
if (a2 <= 0) {
return;
}
DoHarmToMajor(a1, 0, a2);
}
return;
}
void HitGeneral(int a0, int a1, int a2, int a3, int a4, int a5) {
int v1;
int v2;
int v3;
int v4;
int v5;
if (!GetGlobal(3)) {
SetGlobal(3, 1);
v2 = CreateObjectByReference(a1, 2501, 0, 0);
v3 = GetObjectScreenX(a1);
v4 = GetObjectScreenY(a1);
SetObjectCoordinate(v2, v3, v4, a4);
v1 = 0;
while ((v1 < 7)) {
v5 = CreateObjectByReference(v2, a2, 0, 0);
SetObjectScale(v5, 49152, 49152);
MoveObject(v5, Rand((-48), 48), 0, Rand((-48), 48));
switch (a3) {
case 1:
asynccall SmallFireBall(a0, a1, 8, a4);
break;
case 2:
asynccall SmallFireBall3(a0, a1, 8, a4);
break;
case 3:
asynccall SmallFireBall4(a0, a1, 8, a4);
break;
break;
}
Delay(Rand(3, 7));
v1++;
}
FreeObject(v2);
Delay(a5);
SetGlobal(3, 0);
return;
} else {
return;
}
}
int GetGeneralWidth() {
int v1;
v1 = (GetObjectScreenX(intvAttackerMajor) - GetObjectScreenX(intvDefenderMajor));
if (v1 < 0) {
v1 = (-v1);
}
return v1;
}
#define OAF_WALK 2
#define OAF_ATTACK 4
#define OAF_DEFENSE 8
#define OAF_PAIN 0x10
#define OAF_DEATH 0x20
#define OAF_WIN 0x40
#define OAF_ATTACK2 0x800
#define OAF_ATTACK3 0x1000
#define OAF_ATTACK4 0x2000
#define OAF_ATTACK5 0x4000
#define OAF_SPELL1 0x8000
#define OAF_SPELL2 0x10000
#define OAF_SHOT1 0x20000
#define OAF_SHOT2 0x40000
#define OAF_SHOT3 0x80000
#define OAF_ATTACK6 0x100000
#define OAF_ATTACK7 0x200000
#define OAF_ATTACK8 0x400000
#define OF_MAN 0x00000001
#define OF_MISSILE 0x00000002
#define OF_BACKGROUND 0x00000004
#define OF_CAVALRY 0x00000008
#define OF_BLOCKMAN 0x00000010
#define OF_BLOCKMISSILE 0x00000020
#define OF_BIGSHAPE 0x00000040
#define OF_TRIGGERMAN 0x00000100
#define OF_TRIGGERMISSILE 0x00000200
#define OF_NOGRAVITY 0x00010000
#define OF_NONSYNCHRONISM 0x00020000
#define OF_MIXER 0x00040000
#define OF_WHITELIGHT 0x00080000
#define OF_DARKLIGHT 0x00100000
#define OF_TARGET 0x00200000
#define OF_BOMB 0x00400000
#define OF_ENEMYGENERAL 0x01000000
#define OF_ENEMYFORCE 0x02000000
#define OF_ATTACKENEMY 0x03000000
#define OF_MYGENERAL 0x04000000
#define OF_MYFORCE 0x08000000
#define OF_ATTACKMY 0x0c000000
#define OF_ATTACKALL 0x0F000000
// 召唤铁锅
void CastFail(int a0, int a1) {
int v1;
v1 = CreateObjectByReference(a0, 10017, a1, 256);
SetObjectFlags(v1, OF_MYGENERAL);
SetCallbackProcedure(v1, 1000);
SetObjectAnimate(a0, OAF_SPELL1);
SetOverwhelming(a0, 0);
Delay(60);
return;
}
void DelayAmbientSound(string a0, int a1, int a2) {
SetGlobal(1, 1);
PlaySound1(a0, a1);
Delay(a2);
SetGlobal(1, 0);
return;
}
// 摄像机移过去
void MoveCamera(int a0, int a1, int a2) {
int v1;
int v2;
int v3;
int v4;
int v5;
v2 = (GetCameraX() * 1000);
v3 = (GetCameraY() * 1000);
a0 = (a0 * 1000);
a1 = (a1 * 1000);
v4 = (a0 - v2);
v4 = (v4 / a2);
v5 = (a1 - v3);
v5 = (v5 / a2);
v1 = a2;
while ((v1 > 0)) {
v2 = (v2 + v4);
v3 = (v3 + v5);
SetViewCamera((v2 / 1000), (v3 / 1000));
if (((v2 / 100) == (a0 / 100)) && ((v3 / 100) == (a1 / 100))) {
v1 = 1;
}
v1--;
Delay(1);
}
return;
}
// 让天空变黑
void DownBrightness(int a0, int a1) {
int v1;
v1 = GetBackgroundBrightness();
while ((v1 > a0)) {
Delay(a1);
v1--;
SetBackgroundBrightness(v1);
}
SetBackgroundBrightness(16);
LockBrightness(a0);
SetGlobal(2, a0);
return;
}
// 天空渐渐变白
void RaiseBrightness(int a0, int a1) {
int v1;
UnlockBrightness();
v1 = GetGlobal(2);
SetBackgroundBrightness(v1);
while ((v1 < a0)) {
Delay(a1);
v1++;
SetBackgroundBrightness(v1);
}
SetBackgroundBrightness(a0);
return;
}
// 镜头锁定物件
void LockCameraOnObject(int object, int yOffset) {
int dir = GetObjectDir(object);
while(IsObjectExist(object)) {
// 得到欲锁定物件和摄像机自身的x坐标
int objectX = GetObjectScreenX(object);
int cameraX = GetCameraX();
// 检查边界:如果飞出战场,则直接退出
if (cameraX < 0 || cameraX >= GetBattleWidthInScreenX())
break;
// 检查物件与摄像机的距离
int dx = objectX - cameraX;
// 如果物件正在飞离摄像机,则移动摄像机,否则什么也不做
if ((dir == 0 && dx > 0) || (dir == 128 && dx < 0))
SetCameraByReference(object, 0, yOffset);
Delay(1);
}
}
void SmallFireBall(int a0, int a1, int a2, int a3) {
int v1;
int v2;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10003, Rand(0, 255), a3);
SetObjectScale(v1, 12288, 12288);
SetObjectSpeed_Cylind(v1, Rand(4, 12), Rand((-2), 8));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void SmallFireBall2(int a0, int a1, int a2, int a3) {
int v1;
int v2;
int v3;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10003, Rand(0, 255), a3);
v3 = Rand(8192, 12288);
SetObjectScale(v1, v3, v3);
SetObjectSpeed_Cylind(v1, Rand(3, 7), Rand((-1), 5));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void SmallFireBall3(int a0, int a1, int a2, int a3) {
int v1;
int v2;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10013, Rand(0, 255), a3);
SetObjectScale(v1, 12288, 12288);
SetObjectSpeed_Cylind(v1, Rand(4, 12), Rand((-2), 8));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void SmallFireBall4(int a0, int a1, int a2, int a3) {
int v1;
int v2;
PlaySound(a1, "hit01", 255);
v2 = 0;
while ((v2 < a2)) {
v1 = CreateObjectByReference(a1, 10014, Rand(0, 255), a3);
SetObjectScale(v1, 12288, 12288);
SetObjectSpeed_Cylind(v1, Rand(4, 12), Rand((-2), 8));
SetObjectFriction1(v1, 8192);
SetObjectFadeOut(v1, 32, 1);
SetObjectScaleShrink(v1, 256);
v2++;
}
return;
}
void Hurt(int a0, int a1, int a2) {
if (!((a1 == intvAttackerMajor) || (a1 == intvDefenderMajor))) {
PlaySound(a1, "Hit01", 255);
} else {
ClearObjectFlags(a0, (OF_MYGENERAL + OF_ENEMYGENERAL));
if (a2 <= 0) {
return;
}
DoHarmToMajor(a1, 0, a2);
}
return;
}
void HitGeneral(int a0, int a1, int a2, int a3, int a4, int a5) {
int v1;
int v2;
int v3;
int v4;
int v5;
if (!GetGlobal(3)) {
SetGlobal(3, 1);
v2 = CreateObjectByReference(a1, 2501, 0, 0);
v3 = GetObjectScreenX(a1);
v4 = GetObjectScreenY(a1);
SetObjectCoordinate(v2, v3, v4, a4);
v1 = 0;
while ((v1 < 7)) {
v5 = CreateObjectByReference(v2, a2, 0, 0);
SetObjectScale(v5, 49152, 49152);
MoveObject(v5, Rand((-48), 48), 0, Rand((-48), 48));
switch (a3) {
case 1:
asynccall SmallFireBall(a0, a1, 8, a4);
break;
case 2:
asynccall SmallFireBall3(a0, a1, 8, a4);
break;
case 3:
asynccall SmallFireBall4(a0, a1, 8, a4);
break;
break;
}
Delay(Rand(3, 7));
v1++;
}
FreeObject(v2);
Delay(a5);
SetGlobal(3, 0);
return;
} else {
return;
}
}
int GetGeneralWidth() {
int v1;
v1 = (GetObjectScreenX(intvAttackerMajor) - GetObjectScreenX(intvDefenderMajor));
if (v1 < 0) {
v1 = (-v1);
}
return v1;
}













