Tibia Brasil

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
Tibia Brasil

www.tibiabrazil-blog.blogspot.com


2 participantes

    Atack Diagonal

    ADM Altair Junior
    ADM Altair Junior
    Admin


    Mensagens : 73
    Data de inscrição : 13/05/2009
    Idade : 32

    Atack Diagonal Empty Atack Diagonal

    Mensagem  ADM Altair Junior Dom Mar 14, 2010 1:08 pm

    Const
    Wanted='Dragon';// Altere o nome para outro bixo
    MinCreatureHP= 20 ;
    RampsID = [1950, 1952, 1954, 1956, 385, 1947, 434, 414, 604]

    var
    x: Integer;

    function IsCreatureBesideYou(c: TCreature): boolean;
    begin
    UpdateWorld;
    if (abs(c.X-self.X) <= 1) and (abs(c.Y-self.Y) <= 1) then begin
    if c.Z = self.Z then
    begin
    Result := True;
    Exit;
    end;
    end;
    Result := False;
    end;

    function GetTileFromXYZ(X, Y, Z: integer): TTile;
    begin
    Result := nil;
    if abs((Self.X - 7) - X) > 14 then Exit;
    if abs((Self.Y - 5) - Y) > 11 then Exit;
    if Self.Z <> Z then Exit;
    Result := Screen.Tile[abs((Self.X - 7) - X), abs((Self.Y - 5) - Y)];
    end;
    function IsTileWalkable(Tile: TTile): boolean;
    begin
    Result := True;
    for Z := 0 to Tile.Count - 1 do
    begin
    if Tile.Item[Z].Properties.Hole then
    begin
    Result := False;
    end
    else if Tile.Item[Z].Properties.Stairs then
    begin
    Result := False;
    end
    else if not Tile.Item[Z].Properties.Walkable then
    begin
    OutputDebugString('Not Walk: ' + IntToStr(Tile.Item[Z].ID));
    Result := False;
    end;
    else
    begin
    for x := low(RampsID) to high(RampsID) do
    begin
    if Tile.Item[Z].ID = RampsID[x] then Result := False;
    end;
    end;
    end;
    end;

    function GetCreatureBesideYou: TCreature;
    begin
    UpdateWorld;
    Result := Nil;
    for x := 0 to Creatures.Count - 1 do
    begin
    UpdateWorld;
    if (Creatures.Creature[x].Name=Wanted) then
    if IsCreatureBesideYou(Creatures.Creature[x]) then
    begin
    if Creatures.Creature[x].ID <> Self.ID then
    begin
    UpdateWorld;
    Result := Creatures.Creature[x];
    Exit;
    end;
    end;
    end;
    end;

    var
    Moved:boolean;

    begin
    G:=false;
    T:=false;
    while not terminated do
    begin
    updateworld;
    Creature:=GetCreatureBesideYou;
    if Creature<>nil then
    if Creatures.Creature[Wanted].Health > MinCreatureHP then
    begin
    if (Self.X<>Creature.X) and (Self.Y=Creature.Y) then
    begin
    Tile:=GetTileFromXYZ(Self.x,Self.y-1,self.z);
    if Tile<>nil then
    if IsTileWalkable(Tile) then
    begin
    Self.MoveUp;
    Moved:=true;
    end;
    If (Moved=False) then
    begin
    Tile:=GetTileFromXYZ(Self.x,Self.y+1,self.z);
    if Tile<>nil then
    if IsTileWalkable(Tile) then
    Self.MoveDown;
    end;
    end;
    Moved:=false;
    if (Self.X=Creature.X) and (Self.Y<>Creature.Y) then
    begin
    Tile:=GetTileFromXYZ(Self.x-1,Self.y,self.z);
    if Tile<>nil then
    if IsTileWalkable(Tile) then
    begin
    Self.MoveLeft;
    Moved:=true;
    end;
    If (Moved=False) then
    begin
    Tile:=GetTileFromXYZ(Self.x+1,Self.y,self.z);
    if Tile<>nil then
    if IsTileWalkable(Tile) then
    Self.MoveRight;
    end;
    end;
    end;
    sleep(1000);
    end;
    end;

    Legenda:
    Vermelho: Altere o nome para o bixo que você deseje que fique na diagonal atacando

    Download
    avatar
    Megaman9


    Mensagens : 148
    Data de inscrição : 05/11/2011

    Atack Diagonal Empty Re: Atack Diagonal

    Mensagem  Megaman9 Ter Nov 08, 2011 2:01 pm



    Pagina Ownada !!!


    Pixel lfie by zeruel[ pixellife.forumotion.com/forum]

      Data/hora atual: Sáb Set 28, 2024 9:12 pm