📄 wog_fight_m.php
字号:
$support_skill["s_m_agl"]=1;$support_skill["s_m_df"]=1;
*/
$support_skill=$me_skill;
// $support_skill2=$me_skill;
// $support_skill2=$support_skill;
$s2_kill=$DB_site->query_first("select s_at,s_df,s_mat,s_mdf,s_agl,s_money,s_r,s_o,s_s,s_a,s_m_at,s_m_mat,s_m_df,s_m_mdf,s_m_agl,s_hp from wog_character where ch_id=".$p_support[p_ch_s_id]."");
}
if($pet!=null)//宠物个性判断
{
switch($pet[pe_type])
{
case 1:
$pet[pe_at]=$pet[pe_at]*1.2;
break;
case 2:
$pet[pe_mt]=$pet[pe_mt]*1.2;
break;
case 3:
$pet[pe_def]=$pet[pe_def]*1.2;
break;
case 4:
$pet[pe_fi]=$pet[pe_fi]*1.5;
break;
}
$petact=((($pet[pe_he]-$pet[pe_hu])/255)*10)+(($pet[pe_fi]/255)*10)+round($p[au]/300);
if($petact>35)
{
$petact=35;
}
$this->petact=$petact;
}
if($p[d_s]!=NULL)
{
$temp_ps=$this->s_check($p[d_s]-$m[m_s]); //属性判断
}else
{
$temp_ps=$this->s_check($p[p_s]-$m[m_s]); //属性判断
}
$temp_ms=$this->s_check($m[m_s]-$p[p_s]); //属性判断
while($p[p_hp]!=0 || $m[m_hp]!=0)
{
//srand ((float) microtime() * 10000000); //php 4.2 以上可以不用
$ss="";
$p_fast=50;
$m_fast=50;
if(rand(1,100) < 10 && $s_kill)//判断奥义是否发动
{
$s_start=1;
if($s_kill["s_hp"] > 0)
{
$bhp=$p[p_hp];
$up_hp=(($p[p_life]+($p[p_smart]*2))*$s_kill["s_hp"]*10);
$p[p_hp]=$p[p_hp]+$up_hp;
echo ",\"parent.fight_event('奥义 $bhp-->$p[p_hp]',$up_hp)\"";
}
$this->skill_money_up=$s_kill["s_money"];
if($p[p_hp]>$p[p_hpmax]){$p[p_hp]=$p[p_hpmax];}
$ss="1";
$me_skill=$s_kill;
}
if($p[p_agl] > $m[p_agl])
{
$p_fast=$p_fast+20;
$m_fast=$m_fast-20;
}else
{
$p_fast=$p_fast-20;
$m_fast=$m_fast+20;
}
if(rand(1,100) < $p_fast) //己先攻
{
//######### pact ##########(己方攻击开始)
$temp_d=$this->fight_p_dm($p,$m,$me_skill,$_POST["at_type"],$ss,$temp_ps);//伤害计算
if(($m[m_hp]-$temp_d)<=0)//判断是否战胜
{
$exp=$this->win_check($user_id,$p,$m,$my_member,$datecut);
break;
}else
{
$m[m_hp]=$m[m_hp]-$temp_d;
$temp_pd+=$temp_d;
}
//(己方攻击结束)
//######### mact ##########(敌方攻击开始)
$temp_d=0;
$m_type=$this->m_type($m[m_at],$m[m_mat]);//判断敌方攻击模式
$temp_d=$this->fight_m_dm($m,$p,$me_skill,$m_type,$pet,$temp_ms);//伤害计算
if($this->pe_def)
{
$pet[pe_def]=$pet[pe_def]-$temp_d;
$temp_d=0;
}
$this->pe_def=0;
if(($p[p_hp]-$temp_d)<=0)//判断是否战败
{
$p[p_hp]=0;
if((int)$_POST["act"]>=20)
{
// $exp=$this->get_exp(0,$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv]*0.2,$p[p_lv],1);
$exp=0;
}else
{
$exp=$this->get_exp($temp_pd,$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv],$p[p_lv],0);
$DB_site->query("update wog_ch_exp set ch_".$p[ch_id]."=ch_".$p[ch_id]."+1 where p_id=".$user_id." ");
$this->temp_win=0;
$this->temp_lost=1;
}
$money=0;
echo ",\"parent.end_date('$p[p_name]','0','$exp',0,'$p[p_hp]')\"";
$this->win=0;
$this->lost=1;
break;
}else
{
$p[p_hp]=$p[p_hp]-$temp_d;
}
//(敌方攻击结束)
}else //怪先攻
{
//######### mact ##########(敌方攻击开始)
$temp_d=0;
$m_type=$this->m_type($m[m_at],$m[m_mat]);//判断敌方攻击模式
$temp_d=$this->fight_m_dm($m,$p,$me_skill,$m_type,$pet,$temp_ms);//伤害计算
if($this->pe_def)
{
$pet[pe_def]=$pet[pe_def]-$temp_d;
$temp_d=0;
}
$this->pe_def=0;
if(($p[p_hp]-$temp_d)<=0)//判断是否战败
{
$p[p_hp]=0;
if((int)$_POST["act"]>=20)
{
// $exp=$this->get_exp(0,$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv]*0.2,$p[p_lv],1);
$exp=0;
}else
{
$exp=$this->get_exp($temp_pd,$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv],$p[p_lv],0);
$DB_site->query("update wog_ch_exp set ch_".$p[ch_id]."=ch_".$p[ch_id]."+1 where p_id=".$user_id." ");
$this->temp_win=0;
$this->temp_lost=1;
}
$money=0;
echo ",\"parent.end_date('$p[p_name]','0','$exp',0,'$p[p_hp]')\"";
$this->win=0;
$this->lost=1;
break;
}else
{
$p[p_hp]=$p[p_hp]-$temp_d;
}
//(敌方攻击结束)
//######### pact ##########(己方攻击开始)
$temp_d=$this->fight_p_dm($p,$m,$me_skill,$_POST["at_type"],$ss,$temp_ps);//伤害计算
if(($m[m_hp]-$temp_d)<=0)//判断是否战胜
{
$exp=$this->win_check($user_id,$p,$m,$my_member,$datecut);
break;
}else
{
$m[m_hp]=$m[m_hp]-$temp_d;
$temp_pd+=$temp_d;
}
//(己方攻击结束)
}
//######### p_support ##########(队友攻击开始)
$temp_d=0;
if($p_support!=null)
{
if(rand(1,100) < 15 && $p_support["p_hp"] > ($p_support["p_hpmax"]*0.1))
{
if(rand(1,100) < 10)
{
$temp_d=$this->fight_p_dm($p_support,$m,$s2_kill,rand(1,2),$ss,$temp_ps,1);//伤害计算
}else
{
$temp_d=$this->fight_p_dm($p_support,$m,$support_skill,rand(1,2),$ss,$temp_ps,1);//伤害计算
}
if(($m[m_hp]-$temp_d)<=0)//判断是否战胜
{
$exp=$this->win_check($user_id,$p,$m,$my_member,$datecut);
break;
}else
{
$m[m_hp]=$m[m_hp]-$temp_d;
$temp_pd+=$temp_d;
}
}
}
//(队友攻击结束)
//######### petact ##########(宠物攻击开始)
$temp_d=0;
if($pet!=null)
{
if(rand(1,100) < $this->petact && $pet[pe_def] > 0)
{
$fight_type=rand(1,3);
if($fight_type==1)
{
$temp_d=$this->fight_pet_dm($pet[pe_at],$pet[pe_name],$m,$pet[pe_mimg],"1");//伤害计算
}elseif($fight_type==2)
{
$temp_d=$this->fight_pet_dm($pet[pe_mt],$pet[pe_name],$m,$pet[pe_mimg],"2");//伤害计算
}elseif($fight_type==3)
{
$temp_d=$this->fight_pet_dm(($pet[pe_at]+$pet[pe_mt])*1.5,$pet[pe_name],$m,$pet[pe_mimg],"3");//伤害计算
}
$pet[pe_mimg]="";
}
if(($m[m_hp]-$temp_d)<=0)//判断是否战胜
{
$exp=$this->win_check($user_id,$p,$m,$my_member,$datecut);
break;
}else
{
$m[m_hp]=$m[m_hp]-$temp_d;
$temp_pd+=$temp_d;
}
}
//(宠物攻击结束)
$sum++;
if($sum>=$this->f_count)//判断战斗是否超过回合数设定
{
if((int)$_POST["act"]>=20)
{
// $exp=$this->get_exp($temp_pd,$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv]*0.2,$p[p_lv],0);
$exp=0;
}else
{
$exp=$this->get_exp($temp_pd,$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv]*0.6,$p[p_lv],0);
}
$money=0;
echo ",\"parent.end_date('$p[p_name] ".sprint($lang['wog_fight_over_time'],$this->f_count)." ','0','$exp',0,'$p[p_hp]')\"";
$this->win=0;
$this->lost=1;
break;
}
//(敌方攻击结束)
if($s_start==1)//结束奥义状态
{
$s_start=0;
$me_skill=$me_skill2;
}
if($p[p_hpmax]*$this->f_hp > $p[p_hp] && $p[d_item_id]>0 && $p[d_g_hp] > 0)
{
$bhp=$p[p_hp];
$p[p_hp]=$p[p_hp]+$p[d_g_hp];
if($p[p_hp]>$p[p_hpmax]){$p[p_hp]=$p[p_hpmax];}
$p[d_item_id]=0;
echo ",\"parent.fight_event('$p[d_name] $bhp-->$p[p_hp]',$p[d_g_hp])\"";
echo ",\"parent.d_item_name=''\"";
}
}
$this->cp_m_hp=$m[m_hp];//冠军的hp,若在冠军挑战模式下,冠军hp将会被写入db
unset($m);
unset($s_kill);
unset($me_skill);
unset($me_skill2);
unset($s2_kill);
unset($support_skill);
// unset($support_skill2);
unset($pet);
unset($my_member);
$p[p_exp]+=$exp;
$money=$this->money;
if($p[d_item_id]==""){$p[d_item_id]=0;}
if($p[p_exp]>$p[p_nextexp])//判断是否升级
{
$this->lv_up($user_id,$p,$money);
}else
{
$DB_site->query("update wog_player set p_exp=".$p[p_exp].",p_money=p_money+".($money+$cp).",p_hp=".$p[p_hp].",p_win=p_win+".$this->temp_win.",p_lost=p_lost+".$this->temp_lost.",p_act_time ='".time()."',p_online_time=".time()."
,p_sat_name='".htmlspecialchars(stripslashes(trim($_POST["sat_name"])))."',d_item_id=".$p[d_item_id].",p_place=".$this->p_place."
where p_id=".$user_id." ");
}
return $p;
unset($p);
}
function win_check($user_id,$p,$m,$my_member,$datecut)
{
global $DB_site,$_POST;
if((int)$_POST["act"]>=20)
{
// $exp=$this->get_exp($m[m_hpmax],$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv]*0.2,$p[p_lv],1);
$exp=0;
$money=0;
}else
{
$exp=$this->get_exp($m[m_hpmax],$m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv],$p[p_lv],1);
$money=$this->get_money($m[m_hpmax],$m[m_at],$m[m_mat],$m[m_lv])*$this->skill_money_up;
$DB_site->query("update wog_ch_exp set ch_".$p[ch_id]."=ch_".$p[ch_id]."+1 where p_id=".$user_id." ");
$this->temp_win=1;
$this->temp_lost=0;
}
$this->win=1;
$this->lost=0;
$this->money=round($money);
$member_exp=0;
if(!empty($my_member["members"]) && $exp > 0)
{
$member_exp=round(($exp*0.3)/$my_member["members"]);
$exp=$exp*0.7;
}
if(!empty($my_member["members"]) && $exp > 0)
{
$DB_site->query("update wog_player set p_exp=p_exp+".$member_exp." where p_id<>".$user_id." and t_id=".$p["t_id"]." and p_act_time > $datecut and p_place=".$this->p_place." and p_lock=0 ");
}
$exp=round($exp);
echo ",\"parent.end_date('$p[p_name]','1','$exp','$this->money','$p[p_hp]')\"";
return $exp;
}
function s_check($temp_s)
{
switch($temp_s)
{
case -1:
$temp_s=1.3;
break;
case 1:
$temp_s=0.7;
break;
case 5:
$temp_s=1.3;
break;
case -5:
$temp_s=0.7;
break;
default:
$temp_s=1;
break;
}
return $temp_s;
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -