~armagetronad-ap/armagetronad/BattleMania

« back to all changes in this revision

Viewing changes to src/special/attack/target.php

  • Committer: zodiacsohma1 at gmail
  • Date: 2014-03-02 08:09:55 UTC
  • Revision ID: zodiacsohma1@gmail.com-20140302080955-r5ot6eipfe0nlpww
Simplified all fields and code in all areas for better as they seem to repeat themselves.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
function clearTargets()
11
11
{
12
12
    foreach (Base::$base->RECORDS as $record)
13
 
        if (isset($record) && !is_null($record) && $record instanceof Record)
 
13
        if (isset($record) && $record instanceof Record)
14
14
            $record->target = null;
15
15
}
16
16
 
17
17
function clearTarget(Player $player)
18
18
{
19
19
    $record = getRecord($player->log);
20
 
    if (isset($record) && !is_null($record) && $record instanceof Record)
 
20
    if (isset($record) && $record instanceof Record)
21
21
    {
22
 
        if (isset($record->target) && !is_null($record->target) && $record->target instanceof Cycle)
 
22
        if (isset($record->target) && $record->target instanceof Cycle)
23
23
        {
24
24
            $record->target = null;
25
25
            pm($player, "0xffff7f-clear-target: 0x339aaffTarget cleared!");
49
49
    }
50
50
 
51
51
    $record = getRecord($player->log);
52
 
    if (isset($record) && !is_null($record) && $record instanceof Record)
 
52
    if (isset($record) && $record instanceof Record)
53
53
    {
54
54
        $found_players = array();
55
55
        foreach (Base::$base->PLAYERS as $p)
56
56
        {
57
 
            if (isset($p) && !is_null($p) && $p instanceof Player && isset($p->cycle) && !is_null($p->cycle) && $p->cycle instanceof Cycle && $p->cycle->alive)
 
57
            if (isset($p) && $p instanceof Player && isset($p->cycle) && $p->cycle instanceof Cycle && $p->cycle->alive)
58
58
            {
59
59
                if (contains(Filter($p->name), Filter($target_name), false))
60
60
                {
73
73
        if (count($found_players) == 1)
74
74
        {
75
75
            $p = $found_players[0];
76
 
            if (isset($p) && !is_null($p) && $p instanceof Player)
 
76
            if (isset($p) && $p instanceof Player)
77
77
            {
78
78
                $record->target = $p->cycle;
79
79
                con("0xffff88".$player." 0x44ccffis now locked onto ".$p."!");
87
87
                $players_msg = "";
88
88
                foreach ($found_players as $key => $p)
89
89
                {
90
 
                    if (isset($p) && !is_null($p) && $p instanceof Player)
 
90
                    if (isset($p) && $p instanceof Player)
91
91
                    {
92
92
                        if (($key + 1) == count($found_players))
93
93
                            $players_msg .= "0x77ff88".$p->name;