78 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			78 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								文件名:ap_Meteorsword.nut
							 | 
						||
| 
								 | 
							
								路径:character/Swordman/WeaponMaster/ap_Meteorsword.nut
							 | 
						||
| 
								 | 
							
								创建日期:2022-10-09	01:03
							 | 
						||
| 
								 | 
							
								文件用途:
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								function sq_AddFunctionName(appendage) {
							 | 
						||
| 
								 | 
							
								    appendage.sq_AddFunctionName("proc", "proc_appendage_meteorsword")
							 | 
						||
| 
								 | 
							
								    appendage.sq_AddFunctionName("onStart", "onStart_appendage_meteorsword")
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function sq_AddEffect(appendage) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function proc_appendage_meteorsword(appendage) {
							 | 
						||
| 
								 | 
							
								    if (!appendage) return;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    local parentObj = appendage.getParent(); //获得父对象
							 | 
						||
| 
								 | 
							
								    local sourceObj = appendage.getSource(); //获得源对象
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    if (!sourceObj || !parentObj || sourceObj.getState() == STATE_STAND) {
							 | 
						||
| 
								 | 
							
								        appendage.setValid(false);
							 | 
						||
| 
								 | 
							
								        return;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    local startX = appendage.getVar().get_vector(0);
							 | 
						||
| 
								 | 
							
								    local startY = appendage.getVar().get_vector(1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    sourceObj = sq_GetCNRDObjectToSQRCharacter(sourceObj); //将基础类对象转化为 角色对象
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    if (sourceObj.getState() != 235) {
							 | 
						||
| 
								 | 
							
								        appendage.setValid(false);
							 | 
						||
| 
								 | 
							
								        return;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    local chrX = sq_GetDistancePos(sourceObj.getXPos(), sourceObj.getDirection(), 200);
							 | 
						||
| 
								 | 
							
								    local chrY = sourceObj.getYPos();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    local currT = appendage.getTimer().Get();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    local maxT = 500;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    if (currT < maxT) {
							 | 
						||
| 
								 | 
							
								        local currX = sq_GetUniformVelocity(startX, chrX, currT, maxT);
							 | 
						||
| 
								 | 
							
								        local currY = sq_GetUniformVelocity(startY, chrY, currT, maxT);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        parentObj.setCurrentPos(currX, currY, parentObj.getZPos());
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    } else {
							 | 
						||
| 
								 | 
							
								        appendage.setValid(false);
							 | 
						||
| 
								 | 
							
								        return;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function onStart_appendage_meteorsword(appendage) {
							 | 
						||
| 
								 | 
							
								    if (!appendage) {
							 | 
						||
| 
								 | 
							
								        return;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    local parentObj = appendage.getParent();
							 | 
						||
| 
								 | 
							
								    local sourceObj = appendage.getSource();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    if (!sourceObj || !parentObj) {
							 | 
						||
| 
								 | 
							
								        appendage.setValid(false);
							 | 
						||
| 
								 | 
							
								        return;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    appendage.getVar().clear_vector();
							 | 
						||
| 
								 | 
							
								    appendage.getVar().push_vector(parentObj.getXPos());
							 | 
						||
| 
								 | 
							
								    appendage.getVar().push_vector(parentObj.getYPos());
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |