当前位置: 首页>>代码示例>>PHP>>正文


PHP Weapon::getUserAttackWeapons方法代码示例

本文整理汇总了PHP中Weapon::getUserAttackWeapons方法的典型用法代码示例。如果您正苦于以下问题:PHP Weapon::getUserAttackWeapons方法的具体用法?PHP Weapon::getUserAttackWeapons怎么用?PHP Weapon::getUserAttackWeapons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weapon的用法示例。


在下文中一共展示了Weapon::getUserAttackWeapons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

			$weapon->weaponId = $wId;
			$weapon->isAttack = 0;
			$weapon->weaponCount = $amount;
			$weapon->weaponStrength = $conf['weapon' . $wId . 'strength'];
			if ($amount and $weapon->create()) {
				$t->daWeapons[] = $weapon;
			}
		}
		$user->cacheStats();
	}
	else {
		$t->err = 'Not enough Gold';
	}
	
	
}

$t->user = $user;

if (!$t->saWeapons and !$t->daWeapons) {
	$t->saWeapons = Weapon::getUserAttackWeapons($user->id);
	$t->daWeapons = Weapon::getUserDefenseWeapons($user->id);
}

$t->saRatio = Weapon::getStrengthRatio($user->id, 1);
$t->daRatio = Weapon::getStrengthRatio($user->id, 0);

$t->pageTitle = 'Armoury';
$t->display();
?>
开发者ID:Naddiseo,项目名称:WW2Game,代码行数:30,代码来源:armoury.php

示例2: debug

$defenseWeaponsRatio = Weapon::getStrengthRatio($target->id, false);

debug("defenseRatio: $defenseWeaponsRatio->ratio");

$attacklog->attackerRA = $user->RA *  rand($attackLowPer, 100) * 0.01;
$attacklog->targetRA   = $target->RA * rand($defenseLowPer, 100) * 0.01;

debug("attacker RA: $attacklog->attackerRA, <Br>targetRA: $attacklog->targetRA");

$raWeapons      = array();
$raWeaponsRatio = 0;

if ($attacklog->attackerRA > $attacklog->targetRA) {
	// Attacker has more RA, so he can damage the target's attack weapons
	$attackWeaponsRatio->ratio  *= 1.03;
	$raWeapons                   = Weapon::getUserAttackWeapons($target->id);
	$raWeaponsRatio              = Weapon::getStrengthRatio($target->id, true);
	$raDmg                       = floor($raWeaponsRatio->ratio * 0.002 * $attackTurns);
	debug("Attacker won in RA, ratio: $raWeaponsRatio->ratio");
	debug("raDmg: floor($raWeaponsRatio->ratio * 0.002 * $attackTurns) = $raDmg");
	
}
else {
	// Target has more RA, so he can damage the attacker's defense weapons
	$defenseWeaponsRatio->ratio *= 1.03;
	$raWeapons                   = Weapon::getUserDefenseWeapons($user->id);
	$raWeaponsRatio              = Weapon::getStrengthRatio($user->id, false);
	$raDmg                       = floor($raWeaponsRatio->ratio * 0.002 * $attackTurns);
	debug("Target won in RA, ratio: $raWeaponsRatio->ratio");
	debug("raDmg: floor($raWeaponsRatio->ratio * 0.002 * $attackTurns) = $raDmg");
}
开发者ID:Naddiseo,项目名称:WW2Game,代码行数:31,代码来源:attack.php


注:本文中的Weapon::getUserAttackWeapons方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。