Jump to content
Sign in to follow this  
defohost

Ship Logic/Attributes

Recommended Posts

1. How are the boat attributes calculated with each level up?

2. Can a person increase specific boat stats at any time with stat points? 

3. Where is the logic that is associated with boat attributes and how they increase? 

4. When a person is on a ship, only the ship gains EXP and not the character, or both of them do?

Share this post


Link to post
Share on other sites

1. refer code related to ship attribute

function Ship_ExAttrCheck ( cha_role , ship_role ) 

	if ship_role == nil then 
		LG("luascript_err" , "Ship_ExAttrCheck ship index as null" ) 
		return 0 
	end 
	
	if cha_role == nil then 
		LG ( "luascript_err" , " function Ship_ExAttrCheck :cha_role as null " ) 
		return 
--		ship_mnatk_final	=	Ship_BSMnatk ( ship_role )						--船只基本最小攻击
--		ship_mxatk_final	=	Ship_BSMxatk ( ship_role )						--船只基本最大攻击
--		ship_adis_final		=	Ship_BSAdis ( ship_role )						--船只基本攻击距离
--		ship_cspd_final		=	Ship_BSCspd ( ship_role )						--炮弹基本飞行速度
--		ship_aspd_final		=	Ship_BSAspd ( ship_role )						--炮弹基本攻击间隔
--		ship_crange_final	=	Ship_BSCrange ( ship_role ) 						--炮弹基本爆炸范围
--		ship_def_final		=	Ship_BSDef ( ship_role ) 						--船只基本防御
--		ship_resist_final	=	Ship_BSResist ( ship_role ) 						--船只基本抵抗
--		ship_mxhp_final		=	Ship_BSMxhp ( ship_role ) 						--船只基本最大耐久
--		ship_hrec_final		=	Ship_BSHrec ( ship_role ) 						--船只基本耐久回复速度
--		ship_srec_final		=	Ship_BSSrec ( ship_role ) 						--船只基本补给消耗速度
--		ship_mspd_final		=	Ship_BSMspd ( ship_role ) 						--船只基本移动速度
--		ship_mxsp_final		=	Ship_BSMxsp ( ship_role ) 						--船只基本最大补给值
	else 
		lv = GetChaAttr ( ship_role , ATTR_LV ) 
		job = GetChaAttr ( cha_role , ATTR_JOB ) 
		sta = GetChaAttr ( cha_role , ATTR_STA ) 
		ship_mnatk_final	=	Boat_plus_MNATk ( lv , Ship_Mnatk_final ( cha_role , ship_role ) )			--船只最终最小攻击
		ship_mxatk_final	=	Boat_plus_MXATk ( lv , Ship_Mxatk_final ( cha_role , ship_role ) )			--船只最终最大攻击
		ship_adis_final		=	Ship_Adis_final ( cha_role , ship_role )						--船只最终攻击距离
		ship_cspd_final		=	Ship_Cspd_final ( cha_role , ship_role )						--炮弹最终飞行速度
		ship_aspd_final		=	math.floor ( 100000 / Ship_Aspd_final ( cha_role , ship_role ) ) 			--炮弹最终攻击间隔
		ship_crange_final	=	Ship_Crange_final ( cha_role , ship_role )						--炮弹最终爆炸范围
		ship_def_final		=	Boat_plus_def ( lv , Ship_Def_final ( cha_role , ship_role )	) 			--船只最终防御
		ship_resist_final	=	Ship_Resist_final ( cha_role , ship_role )						--船只最终抵抗
		ship_mxhp_final		=	Boat_plus_Mxhp ( lv , Ship_Mxhp_final ( cha_role , ship_role ) ) 			--船只最终最大耐久
		ship_hrec_final		=	Ship_Hrec_final ( cha_role , ship_role )						--船只最终耐久回复速度
		ship_srec_final		=	Ship_Srec_final ( cha_role , ship_role )						--船只最终补给消耗速度
		ship_mspd_final		=	Boat_plus_Mspd ( lv , Ship_Mspd_final ( cha_role , ship_role ) )  			--船只最终移动速度
		ship_mxsp_final		=	Ship_Mxsp_final ( cha_role , ship_role )						--船只最终最大补给值
	end
	--SystemNotice( cha_role , "Min Attack"..ship_mnatk_final)
	--ship_mnatk_final		=	Boat_plus_MNATk ( lv , ship_mnatk_final)
	--ship_mxatk_final		=	Boat_plus_MXATk ( lv , ship_mxatk_final)
	--ship_def_fina			=	Boat_plus_DEF ( lv , ship_def_final)
	--ship_mxhp_final		=	Boat_plus_Mxhp ( lv , ship_mxhp_final)
	--ship_mspd_final		=	Boat_plus_Mspd ( lv , ship_mspd_final)
--	SetCharaAttr(lv, ship_role, ATTR_LV )											--[[赋值船只lv]]--
	SetCharaAttr(job, ship_role, ATTR_JOB )											--[[赋值船只职业]]--
	SetCharaAttr(sta, ship_role, ATTR_STA )											--[[赋值船只精神]]--
	SetCharaAttr(ship_mnatk_final, ship_role, ATTR_MNATK )									--[[赋值最终mnatk]]--
	SetCharaAttr(ship_mxatk_final, ship_role, ATTR_MXATK )									--[[赋值最终mxatk]]--
	SetCharaAttr(ship_adis_final, ship_role, ATTR_ADIS )									--[[赋值最终adis]]--
	SetCharaAttr(ship_cspd_final, ship_role, ATTR_BOAT_CSPD )								--[[赋值最终船只炮弹飞行速度]]--
	SetCharaAttr(ship_aspd_final, ship_role, ATTR_ASPD )									--[[赋值最终船只攻击速度]]--
	SetCharaAttr(ship_crange_final, ship_role, ATTR_BOAT_CRANGE )								--[[赋值最终船只炮弹爆炸范围]]--
	SetCharaAttr(ship_def_final, ship_role, ATTR_DEF )									--[[赋值最终船只防御]]--
	SetCharaAttr(ship_resist_final, ship_role, ATTR_PDEF )									--[[赋值最终船只抵抗]]--
	SetCharaAttr(ship_mxhp_final, ship_role, ATTR_MXHP )									--[[赋值最终船只最大耐久]]--
	SetCharaAttr(ship_hrec_final, ship_role, ATTR_HREC )									--[[赋值最终船只耐久回复速度]]--
	SetCharaAttr(ship_srec_final, ship_role, ATTR_SREC )									--[[赋值最终船只补给消耗速度]]--
	SetCharaAttr(ship_mspd_final, ship_role, ATTR_MSPD )									--[[赋值最终船只移动速度]]--
	SetCharaAttr(ship_mxsp_final, ship_role, ATTR_MXSP )									--[[赋值最终船只最大补给值]]--

	
	
	SetCharaAttr( 1 , ship_role , ATTR_FLEE )										--船只不具备闪避属性,始终初始化为1 

end 


function	Ship_ExAttrSet ( cha_role , ship_role ) 
end 


function Lifelv_Up ( cha_role )								--生活等级提升
	local life_ap = GetChaAttr ( cha_role , ATTR_LIFETP ) 
	life_ap = life_ap + 1 
	SetCharaAttr( life_ap , cha_role , ATTR_LIFETP ) 
end 

function Saillv_Up ( cha_role )								--航海等级提升

end 



function Resume ( role ) 
	local role_type = ChaIsBoat ( role ) 
	local srec = GetChaAttr ( role , ATTR_SREC ) 
	local sp = GetChaAttr ( role , ATTR_SP ) 
	local mxsp = GetChaAttr ( role , ATTR_MXSP ) 
	local hrec = GetChaAttr ( role , ATTR_HREC ) 
	if hrec < 0 then 
			LG ( "resume_err" , "role = " , GetChaName (role) , "HP recovery rate lower than 0" ) 
			LG ( "resume_err" , "role_hrec_statec = " , GetChaAttr ( role , ATTR_STATEC_HREC) , "role_hrec_statev = ", GetChaAttr ( role , ATTR_STATEV_HREC)  ) 
			LG ( "luascript_err" , "function Resume: character HP recovery rate less than 0" ) 
			return 
	end 
	local hp = GetChaAttr ( role , ATTR_HP ) 
	local mxhp = GetChaAttr ( role , ATTR_MXHP ) 

	if role_type == 1 then									--船只resume
		--Rem_State_NOSEA ( role ) 
--	SystemNotice (role,"enter ship recover")
		if hp <= 0 then 
			LG ( "luascript_err" , "function Resume: Character in dead status" ) 
			return 
		end 
		cha_role = GetMainCha ( role ) 
		if sp <= 0 then 
			BickerNotice ( role , "No more fuel! The ship is being damaged every moment! Get to the nearest Harbor now!" ) 
			hrec = hrec - 0.025 * mxhp 
			srec = 0 
		end 
		sp = math.max ( 0 , sp - srec ) 
		hp = math.min ( mxhp , hp + hrec ) 
		local ship_lv = GetChaAttr ( role , ATTR_LV ) 
		local ship_exp = GetChaAttr ( role , ATTR_CEXP ) 
		local boatexpup_count = GetBoatCtrlTick ( role ) 
		if ( boatexpup_count - math.floor ( boatexpup_count / 5 ) * 5  )  ==  4 then 
			a = 1 
		else	
			a = 0 
		end 
		boatexpup_count = boatexpup_count + 1 
		if boatexpup_count >= 500 then 
			boatexpup_count = 0 
		end 
		SetBoatCtrlTick ( role , boatexpup_count ) 
--		SetAttrChangeFlag( role)

		if ship_lv <= 30 and ship_exp <= 1000  then 
--		if ship_lv <= 50 and ship_exp <= 1000  then 
--			SystemNotice (role,"enter ship expup")
			if a == 1 then 
	--			SystemNotice (role,"ship_expadd = " ..ship_expadd)
	--			SystemNotice (role,"ship_exp = " ..ship_exp)
				local ship_expadd = math.floor ( math.random ( 1, 3 )  + math.max ( 0 , ( 2 - ship_lv /10 ) )  ) 
	--			local ship_expadd = math.floor ( math.random ( 50, 150 ) ) 
				ship_exp = ship_exp + ship_expadd
	--			SystemNotice (role,"after resume ship_exp = " ..ship_exp)
				SystemNotice (role,"Ship EXP gained:" ..ship_expadd)
				SetCharaAttr (ship_exp ,role , ATTR_CEXP ) 
	--			ship_exp = GetChaAttr ( role , ATTR_CEXP ) 
	--			SystemNotice (role,"1 after resume ship_exp = " ..ship_exp)
			end 
		end 
--		cha_hp = math.min ( Mxhp ( cha_role ) , Hp ( cha_role ) + Hrec ( cha_role ) ) 
		cha_sp = math.min ( Mxsp ( cha_role ) , Sp ( cha_role ) + Srec ( cha_role ) ) 
		SetCharaAttr ( sp , role , ATTR_SP ) 
		SetCharaAttr ( hp , role , ATTR_HP ) 
--		SetCharaAttr ( cha_hp , cha_role , ATTR_HP ) 
		SetCharaAttr ( cha_sp , cha_role , ATTR_SP ) 
--		SyncBoat ( role, 4 )
	else 
		if hp <= 0 then 
			LG ( "luascript_err" , "function Resume: Character in dead status" ) 
			return 
		end 
		local Elf_SkillHpResume = 0
		local Elf_SkillSpResume = 0
			
		if mxhp ~= hp then
			Elf_SkillHpResume = ElfSkill_HpResume ( role )
		end
	
		if mxsp ~= sp then
			Elf_SkillSpResume = ElfSkill_SpResume ( role )
		end
		
		hrec = hrec + Elf_SkillHpResume
		srec = srec + Elf_SkillSpResume
		sp = math.min ( mxsp , sp + srec ) 
		hp = math.min ( mxhp , hp + hrec ) 
		SetCharaAttr ( hp , role , ATTR_HP ) 
		SetCharaAttr ( sp , role , ATTR_SP ) 
	end 
end 

 

 

2. No. Ship only affected by buff item. speed buff, skill cast from ship, ship invisibility, ship repair and etc.

 

3. Also refer code.

 

4. Both fairy and char exp are not calculated.

  • Thanks 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...