C6AD18B3169D0A0100783718 /* Gallery.m in Sources */ = {isa = PBXBuildFile; fileRef = C6AD18B2169D0A0100783718 /* Gallery.m */; };
C6AD18B7169D1E9900783718 /* セレクター.png in Resources */ = {isa = PBXBuildFile; fileRef = C6AD18B6169D1E9900783718 /* セレクター.png */; };
C6B6D9361B942B200073242D /* LevelList.m in Sources */ = {isa = PBXBuildFile; fileRef = C6B6D9351B942B200073242D /* LevelList.m */; };
+ C6B78E011CBB0397005CEB9E /* hitSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C6B78E001CBB0397005CEB9E /* hitSound.mp3 */; };
C6BCF51A169D575900DC5D53 /* タイトル.png in Resources */ = {isa = PBXBuildFile; fileRef = C6BCF519169D575900DC5D53 /* タイトル.png */; };
C6C3697E189148FE00A10A87 /* lc24.png in Resources */ = {isa = PBXBuildFile; fileRef = C6C3697D189148FE00A10A87 /* lc24.png */; };
C6C6685E1A95C5C6006BAECB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C6C6685D1A95C5C6006BAECB /* Images.xcassets */; };
C6AD18B6169D1E9900783718 /* セレクター.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "セレクター.png"; sourceTree = "<group>"; };
C6B6D9341B942B200073242D /* LevelList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelList.h; sourceTree = "<group>"; };
C6B6D9351B942B200073242D /* LevelList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LevelList.m; sourceTree = "<group>"; };
+ C6B78E001CBB0397005CEB9E /* hitSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = hitSound.mp3; sourceTree = "<group>"; };
C6BCF519169D575900DC5D53 /* タイトル.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "タイトル.png"; sourceTree = "<group>"; };
C6C3697D189148FE00A10A87 /* lc24.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lc24.png; sourceTree = "<group>"; };
C6C6685D1A95C5C6006BAECB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
C60E05A0166B143C003D5239 /* Supporting Files */ = {
isa = PBXGroup;
children = (
+ C6B78E001CBB0397005CEB9E /* hitSound.mp3 */,
C60E05A1166B143C003D5239 /* Awars III-Info.plist */,
C60E05A2166B143C003D5239 /* InfoPlist.strings */,
C60E05A5166B143C003D5239 /* main.m */,
C6F2A24A16C06D7400992C42 /* mc1.png in Resources */,
C6F2A24E16C06DA700992C42 /* mc2.png in Resources */,
C6DC3C251A7AD108007514D1 /* test06.jpg in Resources */,
+ C6B78E011CBB0397005CEB9E /* hitSound.mp3 in Resources */,
C6F2A25016C06DDD00992C42 /* mc3.png in Resources */,
C6F2A25216C06E1600992C42 /* mc4.png in Resources */,
C63622E41A57456B006A20BF /* ucb55.png in Resources */,
#import <Cocoa/Cocoa.h>
#import "FieldScene.h"
+#define BT_POINTX1 35
+#define BT_POINTX2 505
+#define BT_POINTY 120
+#define BT_CHASIZEX 100
+#define BT_CHASIZEY 100
+#define BT_CHADISTANCEDELTA 150
+#define BT_CHAMOVESPEED 10
+
+bool battleVeryBegunFlag;
+bool baseDistanceCompFlag;
+int btDistanceX1;
+int btDistanceX2;
+bool BTunitAttackFlag1;
+bool BTunitAttackFlag2;
+int btAttackMove1;
+int btAttackMoveValue1;
+int btAttackMove2;
+int btAttackMoveValue2;
+bool btHitFlag1;
+bool btHitFlag2;
+int btHitFlagCnt1;
+int btHitFlagCnt2;
+
+
+NSSound *hitSoundBasic;
+
@interface BattleView : NSView
@end
+BattleView *battleView;
\ No newline at end of file
@implementation BattleView
+-(void)awakeFromNib{
+
+ battleView = self;
+ hitSoundBasic = [[NSSound soundNamed:@"hitSound.mp3"] retain];
+}
+
-(BOOL)isFlipped{
return YES;
}
}
+-(void)drawImage:(NSImage*)image x:(float)x y:(float)y f:(float)frac{
+ NSRect frRect;
+ frRect.size.height = image.size.height;
+ frRect.size.width = image.size.width;
+
+ frRect.origin.x = 0;
+ frRect.origin.y = 0;
+
+ NSRect drRect;
+ drRect.origin.x = x;
+ drRect.origin.y = y;
+ drRect.size.height = image.size.height;
+ drRect.size.width = image.size.width;
+
+ [image drawInRect:drRect fromRect:frRect operation:NSCompositeSourceOver fraction:frac respectFlipped:YES hints:nil];
+
+}
- (void)drawRect:(NSRect)dirtyRect
{
// Drawing code here.
+ NSImage *img;
+
+ if(!battleVeryBegunFlag){
+ U = UTop;
+ while (!(AUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ [self drawImage:img x:BT_POINTX1 y:BT_POINTY f:1.0];
+ U = UTop;
+
+ U = UTop;
+ while (!(DUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ [self drawImage:img x:BT_POINTX2 y:BT_POINTY f:1.0];
+ U = UTop;
+ }else if(battleVeryBegunFlag && !BTunitAttackFlag1 && !BTunitAttackFlag2){
+
+
+ btDistanceX1 += BT_CHAMOVESPEED;
+
+ if(btDistanceX1 >= BT_CHADISTANCEDELTA)
+ btDistanceX1 = BT_CHADISTANCEDELTA;
+ U = UTop;
+ while (!(AUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ [self drawImage:img x:BT_POINTX1 + btDistanceX1 y:BT_POINTY f:1.0];
+ U = UTop;
+
+
+ btDistanceX2 += BT_CHAMOVESPEED;
+
+ if(btDistanceX2 >= BT_CHADISTANCEDELTA)
+ btDistanceX2 = BT_CHADISTANCEDELTA;
+ U = UTop;
+ while (!(DUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ [self drawImage:img x:BT_POINTX2 - btDistanceX2 y:BT_POINTY f:1.0];
+ U = UTop;
+
+
+ if(btDistanceX1 >= BT_CHADISTANCEDELTA && btDistanceX2 >= BT_CHADISTANCEDELTA){
+ baseDistanceCompFlag = true;
+ }
+ }else if(BTunitAttackFlag1 && !btHitFlag1){
+
+ U = UTop;
+ while (!(DUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ [self drawImage:img x:BT_POINTX2 - btDistanceX2 y:BT_POINTY f:1.0];
+ U = UTop;
+
+ U = UTop;
+ while (!(AUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ if(btAttackMoveValue1 == 0){
+ btAttackMove1 += 20;
+ }else if(btAttackMoveValue1 == 1){
+ btAttackMove1 += -20;
+ }
+
+ if(btAttackMove1 >= 80){
+ btAttackMoveValue1 = 1;
+ }
+ if(btAttackMove1 <= 0){
+ if(btAttackMoveValue1 < 2)
+ btHitFlag1 = true;
+ btAttackMoveValue1 = 2;
+ }
+
+ if(btAttackMoveValue1 < 2){
+ [self drawImage:img x:BT_POINTX1 + btDistanceX1 + btAttackMove1 y:BT_POINTY f:1.0];
+ }else{
+ [self drawImage:img x:BT_POINTX1 + btDistanceX1 y:BT_POINTY f:1.0];
+ }
+ U = UTop;
+
+
+
+ }else if(BTunitAttackFlag2 && !btHitFlag2){
+
+
+ U = UTop;
+ while (!(AUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ [self drawImage:img x:BT_POINTX1 + btDistanceX1 y:BT_POINTY f:1.0];
+ U = UTop;
+
+ U = UTop;
+ while (!(DUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ if(btAttackMoveValue2 == 0){
+ btAttackMove2 += 20;
+ }else if(btAttackMoveValue2 == 1){
+ btAttackMove2 += -20;
+ }
+
+ if(btAttackMove2 >= 80){
+ btAttackMoveValue2 = 1;
+ }
+ if(btAttackMove2 <= 0){
+ if(btAttackMoveValue2 < 2)
+ btHitFlag2 = true;
+ btAttackMoveValue2 = 2;
+ }
+
+ if(btAttackMoveValue2 < 2){
+ [self drawImage:img x:BT_POINTX2 - btDistanceX2 - btAttackMove2 y:BT_POINTY f:1.0];
+ }else{
+ [self drawImage:img x:BT_POINTX2 - btDistanceX2 y:BT_POINTY f:1.0];
+ }
+ U = UTop;
+
+ }else if(btHitFlag1){
+
+
+ btHitFlagCnt1++;
+
+ U = UTop;
+ while (!(AUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ if (btHitFlagCnt1 == 1)
+ [hitSoundBasic play];
+ if(btHitFlagCnt1 > 10)
+ btHitFlagCnt1 = 10;
+
+
+ [self drawImage:img x:BT_POINTX1 + btDistanceX1 y:BT_POINTY f:1.0];
+
+ U = UTop;
+
+ U = UTop;
+ while (!(DUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ if(btHitFlagCnt1%2 == 0) [self drawImage:img x:BT_POINTX2 - btDistanceX2 y:BT_POINTY f:1.0];
+ U = UTop;
+
+
+ }else if(btHitFlag2){
+ btHitFlagCnt2++;
+
+ U = UTop;
+ while (!(DUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ if (btHitFlagCnt2 == 1)
+ [hitSoundBasic play];
+ if(btHitFlagCnt2 > 10)
+ btHitFlagCnt2 = 10;
+
+
+ [self drawImage:img x:BT_POINTX2 - btDistanceX2 y:BT_POINTY f:1.0];
+
+ U = UTop;
+
+ U = UTop;
+ while (!(AUN[1] == U->number)) {
+ U = U->next;
+ }
+
+ img = [U->C.imgb copy];
+ [img setSize:NSMakeSize(BT_CHASIZEX, BT_CHASIZEY)];
+
+ if(btHitFlagCnt2%2 == 0) [self drawImage:img x:BT_POINTX1 + btDistanceX1 y:BT_POINTY f:1.0];
+ U = UTop;
+
+ }
+
+
}
@end
#import "UnitChipList.h"
#import "BuildChipList.h"
#import "EventScene.h"
+#import "BattleView.h"
typedef struct _UNIT{
struct _UNIT *next;
-(void)DisplayMessage{
-
+ battleVeryBegunFlag = true;
if(AVpreview){
if(AVpreview.rate > 0){
if(bLoopFlag) break;
[battleDialog setStringValue:@"攻撃開始!"];
+ if(!baseDistanceCompFlag)
+ break;
bLoopFlag = true;
messageProcess++;
break;
case 1:
+ if(bLoopFlag) break;
+
+
+ BTunitAttackFlag1 = true;
+ if(battleDef1Flag || battleDod1Flag)
+ BTunitAttackFlag1 = false;
+
U = UTop;
while (!(DUN[DUNnum] == U->number)) {
U = U->next;
U = UTop;
if(bLoopFlag) break;
+
U = UTop;
while (!(AUN[1] == U->number)) {
U = U->next;
effCun = U;
attackCR = U->C.A;
+ if(btAttackMoveValue1 < 2 && BTunitAttackFlag1){
+
+ message = [message stringByAppendingString:[NSString stringWithFormat:@"%@の%@\n", U->C.name, U->C.A->name]];
+
+ [battleDialog setStringValue:message];
+ U->C.A = aTop;
+ U = UTop;
+
+ return;
+ }
+
if(!battleDef1Flag && !battleDod1Flag) message = [message stringByAppendingString:[NSString stringWithFormat:@"%@の%@\n", U->C.name, U->C.A->name]];
if(grazeFlag) message = [message stringByAppendingString:[NSString stringWithFormat:@"かすりヒット!\n"]];
if(!healFlag) message = [message stringByAppendingString:[NSString stringWithFormat:@"%@は%gのダメージを受けた!", U->C.name, dmg]];
- else message = [message stringByAppendingString:[NSString stringWithFormat:@"%@はHPが%g回復した!", U->C.name, dmg]];
+ else {
+ message = [message stringByAppendingString:[NSString stringWithFormat:@"%@はHPが%g回復した!", U->C.name, dmg]];
+ btHitFlag1 = false;
+ }
}else if(battleDef1Flag){
message = [message stringByAppendingString:[NSString stringWithFormat:@"%@は身構えている", U->C.name]];
+ btHitFlag1 = false;
}else if(battleDod1Flag){
message = [message stringByAppendingString:[NSString stringWithFormat:@"%@は様子をうかがっている", U->C.name]];
-
+ btHitFlag1 = false;
}else{
message = [message stringByAppendingString:[NSString stringWithFormat:@"ミス!%@はダメージを受けていない!", U->C.name]];
+ btHitFlag1 = false;
}
[battleDialog setStringValue:message];
case 2:
+ if(bLoopFlag) break;
+ BTunitAttackFlag1 = false;
+ BTunitAttackFlag2 = true;
+ if(battleDef2Flag || battleDod2Flag)
+ BTunitAttackFlag2 = false;
+ btHitFlag1 = false;
+
U = UTop;
while (!(DUN[1] == U->number)) {
if(!U->C.A){
U->C.A = aTop2;
U = UTop;
+ BTunitAttackFlag2 = false;
message = [message stringByAppendingString:[NSString stringWithFormat:@"射程外\n"]];
goto SKIP1;
}
effCun = U;
attackCR2 = U->C.A;
+
+ if(btAttackMoveValue2 < 2 && BTunitAttackFlag2){
+
+ message = [message stringByAppendingString:[NSString stringWithFormat:@"%@の%@\n", U->C.name, U->C.A->name]];
+
+ [battleDialog setStringValue:message];
+ U->C.A = aTop2;
+ U = UTop;
+
+ return;
+ }
+
if(!battleDef2Flag && !battleDod2Flag) message = [message stringByAppendingString:[NSString stringWithFormat:@"%@の%@\n", U->C.name, U->C.A->name]];
if(!battleDef1Flag && !battleDod1Flag && !avPlayerFlag2 && ![U->C.A->AN.movName isEqualToString:@""] && ![U->C.A->AN.movName isEqualToString:@"(null)"] && U->C.A->AN.movName != NULL){
message = [message stringByAppendingString:[NSString stringWithFormat:@"%@は身構えている", U->C.name]];
-
+ btHitFlag2 = false;
}else if(battleDod2Flag){
message = [message stringByAppendingString:[NSString stringWithFormat:@"%@は様子をうかがっている", U->C.name]];
-
+ btHitFlag2 = false;
}else{
message = [message stringByAppendingString:[NSString stringWithFormat:@"ミス!%@はダメージを受けていない!", U->C.name]];
+ btHitFlag2 = false;
}
SKIP1:
[battleDialog setStringValue:message];
g_attackRangeExtent[g][k] = 0;
}
}
+
+ btDistanceX1 = 0;
+ btDistanceX2 = 0;
+ BTunitAttackFlag1 = false;
+ BTunitAttackFlag2 = false;
+ BTunitAttackFlag1 = false;
+ btAttackMoveValue1 = 0;
+ btAttackMoveValue2 = 0;
+ btHitFlag1 = false;
+ btHitFlag2 = false;
+ btHitFlagCnt1 = 0;
+ btHitFlagCnt2 = 0;
+ baseDistanceCompFlag = false;
+ battleVeryBegunFlag = false;
break;
default:
if(!U->CL.A){
U->CL.A = aTop2;
U = UTop;
+
message = [message stringByAppendingString:[NSString stringWithFormat:@"射程外\n"]];
goto SKIP1;
}
-(void)EventLoopBV:(NSTimer*)timer{
+
+ [battleView setNeedsDisplay:YES];
+
static int aniFrame = 0;
if(animationFlag3){
[self setNeedsDisplay:YES];
+
+
}
-(void)DrawImage:(NSImage*)image x:(float)x y:(float)y a:(float)a{
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
- <imageView id="10754">
+ <imageView hidden="YES" id="10754">
<rect key="frame" x="33" y="253" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" imageFrameStyle="photo" id="10794"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
- <imageView id="10809">
+ <imageView hidden="YES" id="10809">
<rect key="frame" x="505" y="253" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" imageFrameStyle="photo" id="10812"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box>
<customView id="11279" customClass="BattleView">
- <rect key="frame" x="-4" y="5" width="643" height="480"/>
+ <rect key="frame" x="0.0" y="0.0" width="643" height="480"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<avPlayerView hidden="YES" autoresizesSubviews="NO" controlsStyle="none" id="8sA-SN-NRK">