04-16-2015, 03:35 AM
Original source: http://ztage.com/forum/viewtopic.php?f=10&t=15234
Well, I found this custom Julian AI in the official LF2 Chinese forum posted 2 years ago, and I thought it to be interesting. I'll test this out later, but feel free to test out and see if you can defeat Julian with this AI of his.
Well, I found this custom Julian AI in the official LF2 Chinese forum posted 2 years ago, and I thought it to be interesting. I'll test this out later, but feel free to test out and see if you can defeat Julian with this AI of his.
Code:
void id(){
D(0,0);
A(0,0);
J(0,0);
right(0,0);
down(0,0);
left(0,0);
up(0,0);
for (int i = 0; i < 400; ++i)
{
for (int i = 0; i < 400; i++){ //target
if (loadTarget(i) == 0 && target.num != self.num && target.hp > 0 && target.id < 100 && target.team != self.team){
break;
}
}
}
if(frame(260,276) && facing(1)){
if(abs(xdistance(self.num,target.num)) < 200 && abs(xdistance(self.num,target.num)) > 100){
D();
}
if(facing(1) && (abs(target.z-self.z) < 150 || abs(xdistance(self.num,target.num)) < 80)){
D();
shadow2();
}
}
else if(abs(target.z-self.z) > 40 && abs(xdistance(self.num,target.num)) > 100) {
if (target.z > self.z)
{
down();
}
else if(target.z < self.z)
{
up();
}
}
else if(target.state == 16 && abs(xdistance(self.num,target.num)) > 0 && abs(xdistance(self.num,target.num)) < 50 && abs(target.z-self.z) < 9){
col();
}
else if(abs(xdistance(self.num,target.num)) > 120 && (target.state == 7 || target.state == 16 || target.state == 15) && abs(target.z-self.z) < 12){
DfJ();
}
else if(abs(xdistance(self.num,target.num)) < 50 && abs(target.z-self.z) < 120){
int r = rand(2);
if(r!=0){A();}else{shadow();}
}
else if(abs(xdistance(self.num,target.num)) < 80 && abs(target.z-self.z) < 30 && (target.state == 14 || target.blink != 0)){
shadow();
} else if(abs(xdistance(self.num,target.num)) > 400 ||(target.state == 14 && abs(xdistance(self.num,target.num)) > 200)){
DbA();
}
else if(target.state != 14 && target.blink == 0) {
DfA();
}
}
void DbA(){
if(xdistance(self.num,target.num) > 0){DlA();}
else{DrA();}
}
void DfA(){
if(xdistance(self.num,target.num) > 0){DrA();}
else{DlA();}
}
void DfJ(){
if(xdistance(self.num,target.num) > 0){DrJ();}
else{DlJ();}
}
void col(){
if(facing(0)){
DuJ();
}
}
void upper_punch(){
if(facing(0)){
DuA();
}
}
void shadow(){
if(facing(1)){
DJA();
}
}
void shadow2(){
if(facing(0)){
DJA();
if(abs(target.z-self.z) > 20) {
if (target.z > self.z)
{
up();
}
else if(target.z < self.z)
{
down();
}
}
}
}
bool frame(int first, int last){
if(self.frame>=first && self.frame<=last){return true;}
else{return false;}
}
bool facing(int tar){
if(tar==0){
if((self.x-target.x)*(2*(self.facing?1:0)-1)>0){return true;}
else{return false;}
}
else{
if((target.x-self.x)*(2*(target.facing?1:0)-1)>0){return true;}
else{return false;}
}
}
int facing_distance(int s, int t){
return xdistance(t,s)*(2*(self.facing?1:0)-1);
}
int xdistance(int s, int t){
loadTarget(s);
int sx=target.x;
loadTarget(t);
int tx=target.x;
return tx-sx;
}