From: <pan...@us...> - 2008-09-18 14:16:16
|
Revision: 353 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=353&view=rev Author: panzaboi Date: 2008-09-18 21:16:26 +0000 (Thu, 18 Sep 2008) Log Message: ----------- Remove unneeded files Removed Paths: ------------- website/application/default/models/Card.php website/application/default/models/CardEffect.php website/application/default/models/EventHandler.php website/application/default/models/Field.php website/application/default/models/MonsterCard.php website/application/default/models/Player.php website/application/default/models/Que.php website/application/default/models/SpellCard.php Property Changed: ---------------- website/library/Zend/ Deleted: website/application/default/models/Card.php =================================================================== --- website/application/default/models/Card.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Card.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,58 +0,0 @@ -<?php - -class Card -{ - const CARDTYPE_MONSTER = "monster"; - const CARDTYPE_SPELL = "spell"; - const CARDTYPE_TRAP = "trap"; - - protected $name; - protected $description; - protected $reference; - protected $cardtype; - - protected $down = true; - - public function __construct($name, $description, $reference, $cardtype) - { - $this->name = $name; - $this->description = $description; - $this->reference = $reference; - $this->cardtype = strtolower($cardtype); - } - - public function getName() { return $this->name; } - public function getDescription() { return $this->description; } - public function getReference() { return $this->reference; } - public function getCardType() { return $this->cardtype; } - public function getFaceDown() { return $this->down; } - - public function setFaceDown($down) { $this->facedown = $down; } - -// public function onSet(){} -// public function onPlay(){} -// public function onFlip(){} -// -// public function onAlliedAttack(){} -// public function onAlliedDefend(){} -// -// public function onDestroy(){} -// public function onDestroyed(){} -// -// public function onAlliedDestroy(){} -// public function onAlliedDestroyed(){} -// -// public function onDraw(){} -// public function onStandby(){} -// public function onMain1(){} -// public function onBattle(){} -// public function onMain2(){} -// public function onEnd(){} - - public function __call($function, $args) - { - return false; - } -} - -?> \ No newline at end of file Deleted: website/application/default/models/CardEffect.php =================================================================== --- website/application/default/models/CardEffect.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/CardEffect.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,47 +0,0 @@ -<?php - -class CardEffect extends Card -{ - protected $card; - - public function __construct(Card $card) - { - $this->card = $card; - } - - public function __call($function, $args) - { - return call_user_func_array(array($this->card, $function), $args); - } - - public function __get($name) - { - return $this->card->{$name}; - } - - public function __set($name, $value) - { - $this->card->{$name} = $value; - } - - /*********************************/ - - public function getName() { return $this->card->getName(); } - public function getDescription() { return $this->card->getDescription(); } - public function getNumber() { return $this->card->getNumber(); } - public function getCardType() { return $this->card->getCardType(); } - public function getFaceDown() { return $this->card->getFaceDown(); } - public function setFaceDown($down) { $this->card->setFaceDown($down); } - -// public function onSet() -// { -// return $this->card->onSet(); -// } -// -// public function onPlay() -// { -// return $this->card->onSet(); -// } -} - -?> \ No newline at end of file Deleted: website/application/default/models/EventHandler.php =================================================================== --- website/application/default/models/EventHandler.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/EventHandler.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,26 +0,0 @@ -<?php - -class EventHandler -{ - const EVENT_PLAY = 1; - const EVENT_SET = 2; - - protected $registeredEvents = array(); - - public function registerEvent($event) - { - if ( !isset($this->registeredEvents[$event->type]) ) - { - $this->registeredEvents[$event->type][$event->id] = array($event); - } - } - - public function fireEvent($event) - { - if ( isset($this->registeredEvents[$event->type]) && isset($this->registeredEvents[$event->type][$event->id]) ) - { - $this->registeredEvents[$event->type][$event->id]->fire(); - } - } - -} \ No newline at end of file Deleted: website/application/default/models/Field.php =================================================================== --- website/application/default/models/Field.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Field.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,164 +0,0 @@ -<?php - -class Field extends Ostacium_Model -{ - const ERR_OK = 1; - const ERR_NOSPACE = 2; - const ERR_SPTAKEN = 3; - - const STATE_DRAW = 1; - const STATE_STANDBY = 2; - const STATE_MAIN1 = 3; - const STATE_BATTLE = 4; - const STATE_MAIN2 = 5; - const STATE_END = 6; - - protected $fieldcard = null; - - protected $currentPlayer = null; - protected $currentState = null; - - protected $numToState = array(1 => 'onDraw', 2 => 'onStandby', 3 => 'onMain1', 4 => 'onBattle', 5 => 'onMain2', 6 => 'onEnd'); - protected $numToStateName = array(1 => 'Draw', 2 => 'Stand-By', 3 => 'Main 1', 4 => 'Battle', 5 => 'Main 2', 6 => 'End'); - - protected $player1; - protected $player2; - - public function __construct($id = null) - { - parent::__construct(); - - $this->player1 = new Player(); - $this->player2 = new Player(); - - if ($id) - $this->_load($id); - } - - protected function _load($id) - { - $game = $this->_db->select()->from('games')->where('id = ?', $id)->query()->fetch(); - - foreach (array('player1', 'player2') as $player) - { - $this->{$player}->load($game[$player.'username'], $game[$player.'lifepoints'], $game[$player.'hand'], $game[$player.'cards'], $game[$player.'monsters'], $game[$player.'spells'], $game[$player.'fusion'], $game[$player.'grave']); - } - - $this->fieldcard = $game['fieldcard']; - } - - public function playCard($player, $card, $where) - { - if (($error = $this->{$player}->canSet($where, $card)) == ERR_OK) - { - $c =& $this->{$player}->playFromHand($where, $card); - // $this->addEvent($c, 'play'); - } - else return $error; - } - - public function setCard($player, $card, $where) - { - if (($error = $this->{$player}->canSet($where, $card)) == ERR_OK) - { - $c =& $this->{$player}->setFromHand($where, $card); - // $this->addEvent($c, 'play'); - } - else return $error; - } - - /******************************************************************************************************************/ - - protected function _getCurrentState($name = false) - { - if ($name) - return $this->numToStateName[$this->currentState]; - else - return $this->currentState; - } - - protected function _getNextState($name = false) - { - $st = ($this->currentState == STATE_END ? STATE_DRAW : $this->currentState + 1); - - if ($name) - return $this->numToStateName[$st]; - else - return $st; - } - - protected function _moveToNextState() - { - $this->currentState = ($this->currentState == STATE_END ? STATE_DRAW : $this->currentState + 1); - $this->{$this->numToState[$this->currentState]}(); - } - - protected function _getCurrentPlayer($obj = false) - { - if ($obj) - return $this->{$this->currentPlayer}; - else - return $this->currentPlayer; - } - - protected function _getNextPlayer($obj = false) - { - $pl = ($this->currentPlayer == 'player1' ? 'player2' : 'player1'); - - if ($obj) - return $this->{$pl}; - else - return $pl; - } - - protected function _getAllCards() - { - $c = $this->_getCurrentPlayer(); - $n = $this->_getNextPlayer(); - - return ($this->monsterzone[$c] + $this->spellzone[$c] + $this->monsterzone[$n] + $this->spellzone[$n]); - } - - /******************************************************************************************************************/ - - public function getEnemyPlayer() - { - $auth = Zend_Auth::getInstance(); - $me = $auth->getStorage()->read()->username; - - return ($me == $this->player1->getUsername() ? $this->player2 : $this->player1); - } - - public function getThisPlayer() - { - $auth = Zend_Auth::getInstance(); - $me = $auth->getStorage()->read()->username; - - return ($me == $this->player1->getUsername() ? $this->player1 : $this->player2); - } - - public function __call($function, $args) - { - if (substr($function, 0, 2) == 'on') - { - $cards = $this->_getAllCards(); - foreach ($cards as $key => $card) - { - try - { - $method = new ReflectionMethod(get_class($card), $function); - if ($method->getDeclaringClass() != 'Card' && $method->getStartLine() != $method->getEndLine()) - { - $method->invoke($card, $args); - } - } - catch(Exception $e) - { - return false; - } - } - } - } -} - -?> \ No newline at end of file Deleted: website/application/default/models/MonsterCard.php =================================================================== --- website/application/default/models/MonsterCard.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/MonsterCard.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,105 +0,0 @@ -<?php - -class MonsterCard extends Card -{ -// const TYPE_Dragon = "Dragon"; -// const TYPE_Spellcaster = "Spellcaster"; -// const TYPE_Zombie = "Zombie"; -// const TYPE_Warrior = "Warrior"; -// const TYPE_BeastWarrior = "Beast-Warrior"; -// const TYPE_Beast = "Beast"; -// const TYPE_WingedBeast = "Winged Beast"; -// const TYPE_Fiend = "Fiend"; -// const TYPE_Fairy = "Fairy"; -// const TYPE_Insect = "Insect"; -// const TYPE_Dinosaur = "Dinosaur"; -// const TYPE_Reptile = "Reptile"; -// const TYPE_Fish = "Fish"; -// const TYPE_SeaSerpent = "Sea Serpent"; -// const TYPE_Machine = "Machine"; -// const TYPE_Thunder = "Thunder"; -// const TYPE_Aqua = "Aqua"; -// const TYPE_Pyro = "Pyro"; -// const TYPE_Rock = "Rock"; -// const TYPE_Plant = "Plant"; -// -// const SUB_Spirit = "Spirit"; -// const SUB_Gemini = "Gemini"; -// const SUB_Toon = "Toon"; -// const SUB_Union = "Union"; -// -// const ATTR_Dark = "Dark"; -// const ATTR_Earth = "Earth"; -// const ATTR_Fire = "Fire"; -// const ATTR_Light = "Light"; -// const ATTR_Water = "Water"; -// const ATTR_Wind = "Wind"; -// -// const MON_Normal = "Normal"; -// const MON_Effect = "Effect"; -// const MON_Fussion = "Fusion"; -// const MON_Ritual = "Ritual"; -// -// const EFF_NoEffect = "No Effect"; -// const EFF_Flip = "Flip Effect"; -// const EFF_Continious = "Continuous Effect"; -// const EFF_Ignition = "Ignition Effect"; -// const EFF_Trigger = "Trigger Effect"; -// const EFF_MultiTrig = "Multi-Trigger Effect"; - - const MODE_ATTACK = "Attack"; - const MODE_DEFENCE = "Defence"; - - protected $level; - protected $attribute; - protected $type; - protected $subtype; - protected $card; - protected $atk; - protected $def; - - protected $mode; - -/**************************************************/ - public function onAttack(){} - public function onDefend(){} - - public function onAlliedAttack(){} - public function onAlliedDefend(){} - - public function onDestroy(){} - public function onDestroyed(){} - - public function onAlliedDestroy(){} - public function onAlliedDestroyed(){} - - public function onTribute(){} -/**************************************************/ - public function getAttack() { return $this->atk; } - public function getDefence() { return $this->def; } - public function getLevel() { return $this->level; } - public function getAttribute() { return $this->attribute; } - public function getType() { return $this->type; } - public function getSubType() { return $this->subtype; } - - public function getMode() { return $this->mode; } - public function setMode($mode) { $this->mode = $mode; } -/**************************************************/ - public function __construct($options) - { - foreach ($options as $key => $value) - { - if ($key == 'name' || $key == 'description' || $key == 'reference' || $key == 'level' || $key == 'attribute' || $key == 'type' || $key == 'subtype' || $key == 'atk' || $key == 'def' || $key == 'cardtype') - { - $this->{$key} = $value; - } - } - } -/**************************************************/ - public function attach(SpellCard $card, $arguments) - { - return new $card($this, $arguments); - } -} - -?> \ No newline at end of file Deleted: website/application/default/models/Player.php =================================================================== --- website/application/default/models/Player.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Player.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,150 +0,0 @@ -<?php - -class Player extends Ostacium_Model -{ - protected $username; - protected $lifepoints; - - protected $hand = array(); - protected $monsterzone = array(); - protected $spellzone = array(); - protected $deckzone = array(); - protected $graveyard = array(); - protected $fusionzone = array(); - - public function __construct() - { - parent::__construct(); - -// if (true) -// $this->load(); - } - - public function load($username, $lifepoints, $handcards, $deck, $monsters, $spells, $fusion, $grave) - { - $this->username = $username; - $this->lifepoints = (int)$lifepoints; - - $hand = explode(";", $handcards); - $monsterzone = explode(";", $monsters); - $spellzone = explode(";", $spells); - $deckzone = explode(";", $deck); - $graveyard = explode(";", $grave); - $fusionzone = explode(";", $fusion); - - $toload = implode(', ', array_merge($hand, $monsterzone, $spellzone, $deckzone, $graveyard, $fusionzone)); - $temp = $this->_db->select()->from('cards')->joinLeft('cardtypes', 'cardtypes.id=cards.cardtype_id', 'cardtypes.name as cardtype')->where('cards.id IN ('.$toload.')')->query()->fetchAll(); - - $cards = array(); - - foreach ($temp as $card) - { - $cards[$card['id']] = $card; - } - - foreach (array('hand', 'monsterzone', 'spellzone', 'deckzone', 'graveyard', 'fusionzone') as $type) - { - foreach (${$type} as $card) - { - if ($card) - { - if (strtolower($cards[$card]['cardtype']) == Card::CARDTYPE_MONSTER) - { - $this->{$type}[] = new MonsterCard($cards[$card]); - } - else - { - $this->{$type}[] = new SpellCard($cards[$card]); - } - } - } - } - } - - public function canSet($where, $card) - { - $what = $this->peekHandCard($card)->getCardType(); - - if ($this->{'get'.ucfirst($what).'Count'}() == 5) return Field::ERR_NOSPACE; - elseif (isset($this->{$what.'zone'}[$where]) && $this->{$what.'zone'}[$where] instanceof Card) return Field::ERR_SPACETAKEN; - else return Field::ERR_OK; - } - - public function &setFromHand($where, $c) - { - $card = $this->getHandCard($c); - $this->{$card->getCardType().'zone'}[$where] = $card; - $card->setFaceDown(true); - - if ($card->getCardType() == Card::CARDTYPE_MONSTER) - $card->setMode(MonsterCard::MODE_DEFENCE); - - return $card; - } - - public function &playFromHand($where, $card) - { - $card = $this->getHandCard($c); - $this->{$card->getCardType().'zone'}[$where] = $card; - $card->setFaceDown(false); - - if ($card->getCardType() == Card::CARDTYPE_MONSTER) - $card->setMode(MonsterCard::MODE_ATTACK); - - return $card; - } - - public function peekHandCard($card) - { - if (isset($this->hand[$card]) && $this->hand[$card] instanceof Card) return $this->hand[$card]; - else return false; - } - - /****************************************************/ - - public function getMonsterCards() - { - return $this->monsterzone; - } - - public function getSpellCards() - { - return $this->spellzone; - } - - public function getUsername() - { - return $this->username; - } - - public function getMonsterCount() - { - return count($monsterzone); - } - - public function getSpellCount() - { - return count($monsterzone); - } - - public function getNextDeckCard() - { - return array_pop($this->deckzone); - } - - public function getHandCard($card) - { - if (isset($this->hand[$card]) && $this->hand[$card] instanceof Card) - { - $what = $this->hand[$card]; - unset($this->hand[$card]); - - return $what; - } - else return false; - } - - /****************************************************/ -} - -?> \ No newline at end of file Deleted: website/application/default/models/Que.php =================================================================== --- website/application/default/models/Que.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Que.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,19 +0,0 @@ -<?php - -class Que -{ - protected $que = array(); - - - public function add($item) - { - array_push($this->que, $item); - } - - public function process() - { - $que[0]->execute; - array_shift($que); - } - -} \ No newline at end of file Deleted: website/application/default/models/SpellCard.php =================================================================== --- website/application/default/models/SpellCard.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/SpellCard.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,39 +0,0 @@ -<?php - -class SpellCard -{ -// const TYPE_Spell = "Spell"; -// const TYPE_Trap = "Trap"; -// -// const ATTR_NORMAL = "Normal"; -// const ATTR_EQUIP = "Equip"; -// const ATTR_FIELD = "Field"; -// const ATTR_QUICK = "Quick-Play"; -// const ATTR_RITUAL = "Ritual"; -// const ATTR_CONT = "Continuous"; -// const ATTR_COUNT = "Counter"; - /**************************************************/ - public function onBlock(){} - /**************************************************/ - - protected $type; - protected $attribute; - /**************************************************/ - public function getType() { return $this->type; } - public function getAttribute() { return $this->attribute; } - /**************************************************/ - public function __construct($options) - { - foreach ($options as $key => $value) - { - if ($key == 'name' || $key == 'description' || $key == 'number' || $key == 'level' || $key == 'attribute' || $key == 'type' || $key == 'atk' || $key == 'def' || $key == 'effect') - { - $this->{$key} = $value; - } - } - } - - /**************************************************/ -} - -?> \ No newline at end of file Property changes on: website/library/Zend ___________________________________________________________________ Added: svn:ignore + Auth Cache Config Console Controller Currency Date Db Feed Filter Form Gdata Http InfoCard Json Layout Ldap Loader Locale Log Mail Measure Memory Mime OpenId Pdf Request Rest Search Server Service Session TimeSync Translate Uri Validate View XmlRpc Acl.php Auth.php Cache.php Config.php Currency.php Date.php Db.php Debug.php Exception.php Feed.php Filter.php Form.php Gdata.php InfoCard.php Json.php Layout.php Ldap.php Loader.php Locale.php Log.php Mail.php Memory.php Mime.php OpenId.php Pdf.php Registry.php Session.php TimeSync.php Translate.php Uri.php Validate.php Version.php View.php Acl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |