전투 추가 구현

This commit is contained in:
2018-08-18 10:53:04 +09:00
parent 8fbbd15dbe
commit ce8ab00a37
6 changed files with 65 additions and 25 deletions
+5 -1
View File
@@ -182,7 +182,7 @@ class WarUnit{
return false;
}
function applyBattleBeginSkillAndItem(){
function applyBattleBeginSkillAndItem():bool{
return false;
}
@@ -220,6 +220,10 @@ class WarUnit{
return false;
}
function applyDB($db):bool{
return false;
}
+14
View File
@@ -51,4 +51,18 @@ class WarUnitCity extends WarUnit{
return true;
}
function applyDB($db):bool{
$updateVals = [];
foreach(array_keys($this->updatedVar) as $key){
$updateVals[$key] = $this->raw[$key];
}
if(!$updateVals){
return false;
}
$db->update('city', $updateVals, 'city=%i', $this->raw['city']);
return $db->affectedRows() > 0;
}
}
+16
View File
@@ -299,5 +299,21 @@ class WarUnitGeneral extends WarUnit{
return true;
}
/**
* @param \MeekroDB $db
*/
function applyDB($db):bool{
$updateVals = [];
foreach(array_keys($this->updatedVar) as $key){
$updateVals[$key] = $this->raw[$key];
}
if(!$updateVals){
return false;
}
$db->update('general', $updateVals, 'no=%i', $this->raw['no']);
return $db->affectedRows() > 0;
}
}