- Timestamp:
- 2015-06-25 02:56:09 (7 years ago)
- Location:
- 2015/26/MikkoL
- Files:
-
- 6 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/Algorithms.cs
r6281 r6304 9 9 public static int DamageFromBasicAttack(double BaseDamage, int Defence) 10 10 { 11 return (int) (Math.Round(BaseDamage + BaseDamage / Defence - Defence) * RandomGen.NextDouble(0.9, 1.1)) + 1;11 return (int)Math.Max((Math.Round(BaseDamage + BaseDamage / Defence - Defence) * RandomGen.NextDouble(0.9, 1.1)), 1); 12 12 } 13 13 14 14 public static int DamageFromCriticalHit(double BaseDamage, int Defence) 15 15 { 16 return (int) (Math.Round(BaseDamage * 2 - Defence / 2) * RandomGen.NextDouble(0.9, 1.1)) + 1;16 return (int)Math.Max((Math.Round(BaseDamage * 2 - Defence / 2) * RandomGen.NextDouble(0.9, 1.1)), 1); 17 17 } 18 18 -
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/AttackList.cs
r6281 r6304 20 20 return Attack; 21 21 } 22 23 public static AttackBase SpookyAttack() 24 { 25 AttackBase SpookyAttack = new AttackBase(); 26 SpookyAttack.DMG = 10; 27 28 SpookyAttack.OnUse = delegate 29 { 30 BattleView.CurrentBattleView.Attacker.CanMakeAction = false; 31 EnemyBase user = BattleView.CurrentBattleView.Attacker; 32 33 CharacterBase character = BattleView.CurrentBattleView.SelectRandomAlly(); 34 35 double BaseDamage = SpookyAttack.BaseDamage(user.Stats.Str, 2); 36 int TrueDamage = BattleAlgorithms.DamageFromBasicAttack(BaseDamage, character.CurrentStats.Def); 37 character.CurrentHP.Value -= TrueDamage; 38 39 BattleView.CurrentBattleView.IsAttackAnimationPlaying = false; 40 BattleView.CurrentBattleView.IsTimerActive = true; 41 }; 42 43 return SpookyAttack; 44 } 22 45 } 23 46 -
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/BattleView.cs
r6281 r6304 17 17 18 18 public EnemyGroup _EnemyGroup { get; set; } 19 public EnemyBase Attacker { get; set; } 19 20 20 21 public List<CharacterBase> Allies = new List<CharacterBase>(); … … 35 36 private ScrollingTextMenu BattleMenu { get; set; } 36 37 38 private float WaitTimeBetweenActions = 1f; 39 private float TimeBetweenActions; 40 37 41 int SelectedEnemy; 38 42 int PrevSelectedEnemy = 0; … … 64 68 Allies.Add(CharacterList.TestChar()); 65 69 Allies.Add(CharacterList.TestChar()); 70 71 for (int i = 0; i < Allies.Count; i++) 72 { 73 Allies[i].Index = i; 74 } 66 75 67 76 LoadEnemies(_Enemies); … … 160 169 { 161 170 HPMeter.Text = Allies[Index].CurrentHP.Value.ToString() + "/" + Allies[Index].CurrentHP.MaxValue.ToString(); 171 172 173 if (Allies[Index].CurrentHP.Value == 0) 174 { 175 Name.TextColor = Microsoft.Xna.Framework.Color.Gray; 176 HPMeter.TextColor = Microsoft.Xna.Framework.Color.Gray; 177 SPMeter.TextColor = Microsoft.Xna.Framework.Color.Gray; 178 179 Allies[Index].WaitTimeMeter.Value = 0; 180 181 Allies[Index].IsDead = true; 182 } 162 183 }; 163 184 … … 224 245 AllyNames[_AllyQueue.Peek().Index].IsFlashing = false; 225 246 AllyNames[_AllyQueue.Peek().Index].TextColor = Microsoft.Xna.Framework.Color.White; 226 227 247 228 248 ActionQueue.Enqueue(delegate … … 350 370 } 351 371 372 public CharacterBase SelectRandomAlly() 373 { 374 int r = RandomGen.NextInt(0, Allies.Count); 375 376 while (Allies[r].CurrentHP.Value == 0) 377 { 378 r = RandomGen.NextInt(0, Allies.Count); 379 } 380 381 return Allies[r]; 382 } 383 352 384 void EndBattle() 353 385 { … … 366 398 BattleHUD.Destroy(); 367 399 BattleMenu.Destroy(); 400 Background.Destroy(); 401 402 OverworldView.CurrentMapData.InitializeEnemies(OverworldView.CurrentMapData.CurrentMapIndex); 368 403 369 404 JRPG.Game.ClearControls(); 370 Background.Destroy();405 371 406 372 407 JRPG.Game.LoadOWControlsKeyboard(); … … 378 413 return delegate 379 414 { 380 IsInMenu = true; 381 382 AllyNames[character.Index].IsFlashing = true; 383 384 BattleMenu = new ScrollingTextMenu(); 385 BattleMenu.SetTextBases(JRPG.Game.MainFont, TextAlignment.Left); 386 387 for (int i = 0; i < character.LearnedAttacks.Count; i++) 388 { 389 int Index = i; 390 391 BattleMenu.AddMenuElement(character.LearnedAttacks[i].Name); 392 BattleMenu.ActionWhenSelected.Add( 393 delegate { 394 _AllyQueue.Cut(character); 395 IsInMenu = true; 396 AllyNames[character.Index].IsFlashing = true; 397 character.LearnedAttacks[Index].OnUse(); } 398 ); 399 } 400 401 if (character.LearnedSkills.Count > 0) 402 { 403 BattleMenu.AddMenuElement("skills"); 415 if (!character.IsDead) 416 { 417 418 IsInMenu = true; 419 420 AllyNames[character.Index].IsFlashing = true; 421 422 BattleMenu = new ScrollingTextMenu(); 423 BattleMenu.SetTextBases(JRPG.Game.MainFont, TextAlignment.Left); 424 425 for (int i = 0; i < character.LearnedAttacks.Count; i++) 426 { 427 int Index = i; 428 429 BattleMenu.AddMenuElement(character.LearnedAttacks[i].Name); 430 BattleMenu.ActionWhenSelected.Add( 431 delegate 432 { 433 _AllyQueue.Cut(character); 434 IsInMenu = true; 435 AllyNames[character.Index].IsFlashing = true; 436 character.LearnedAttacks[Index].OnUse(); 437 } 438 ); 439 } 440 441 if (character.LearnedSkills.Count > 0) 442 { 443 BattleMenu.AddMenuElement("skills"); 444 BattleMenu.ActionWhenSelected.Add(delegate { }); 445 } 446 BattleMenu.AddMenuElement("items"); 404 447 BattleMenu.ActionWhenSelected.Add(delegate { }); 405 } 406 BattleMenu.AddMenuElement("items"); 407 BattleMenu.ActionWhenSelected.Add(delegate { }); 408 BattleMenu.AddMenuElement("flee"); 409 BattleMenu.ActionWhenSelected.Add(Flee()); 410 411 BattleMenu.ActionOnExit = delegate 412 { 413 IsInMenu = false; 414 AllyNames[character.Index].IsFlashing = false; 415 AllyNames[character.Index].TextColor = Microsoft.Xna.Framework.Color.White; 416 }; 417 418 BattleMenu.LoadMenuElements(); 448 BattleMenu.AddMenuElement("flee"); 449 BattleMenu.ActionWhenSelected.Add(Flee()); 450 451 BattleMenu.ActionOnExit = delegate 452 { 453 IsInMenu = false; 454 AllyNames[character.Index].IsFlashing = false; 455 AllyNames[character.Index].TextColor = Microsoft.Xna.Framework.Color.White; 456 }; 457 458 BattleMenu.LoadMenuElements(); 459 } 419 460 }; 420 461 } … … 424 465 for (int i = 0; i < Allies.Count; i++) 425 466 { 426 if (!Allies[i].CanMakeAction )467 if (!Allies[i].CanMakeAction && !Allies[i].IsDead) 427 468 { 428 469 Allies[i].ElapsedTime += deltaTime; … … 438 479 } 439 480 440 for (int i = 0; i < Enemies.Count - 1; i++)481 for (int i = 0; i < Enemies.Count; i++) 441 482 { 442 483 if (!Enemies[i].CanMakeAction) … … 447 488 Enemies[i].ElapsedTime = 0.0; 448 489 Enemies[i].CanMakeAction = true; 490 491 int Index = i; 492 493 ActionQueue.Enqueue(delegate 494 { 495 Attacker = Enemies[Index]; 496 Enemies[Index].PickRandomAttack().OnUse(); 497 }); 449 498 } 450 499 } -
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/Characters/CharacterBase.cs
r6281 r6304 32 32 public double ElapsedTime { get; set; } 33 33 public bool CanMakeAction { get; set; } 34 public bool IsDead { get; set; } 34 35 35 36 public int Level = 1; -
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/Characters/CharacterList.cs
r6281 r6304 10 10 { 11 11 CharacterBase TestChar = new CharacterBase(); 12 TestChar.CurrentStats.HP = 150;12 TestChar.CurrentStats.HP = 50; 13 13 TestChar.CurrentStats.SP = 100; 14 14 -
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/EnemyBase/EnemyBase.cs
r6281 r6304 47 47 public int Luck = 5; 48 48 } 49 50 public AttackBase PickRandomAttack() 51 { 52 int r = RandomGen.NextInt(0, Attacks.Count); 53 54 return Attacks[r]; 55 } 49 56 } -
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/EnemyBase/EnemyGroup.cs
r6281 r6304 8 8 { 9 9 public int EncounterProbability { get; set; } 10 public int Max = 6;10 public int Max = 4; 11 11 12 12 public EnemyGroup() -
2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/EnemyBase/EnemyList.cs
r6281 r6304 19 19 return Testman; 20 20 } 21 22 public static EnemyBase Spookt() 23 { 24 EnemyBase Spookt = new EnemyBase(); 25 26 Spookt.Stats.HP = 40; 27 Spookt.Stats.Def = 10; 28 Spookt.Stats.Res = 20; 29 Spookt.Stats.Str = 5; 30 31 Spookt.Name = "Spookt"; 32 Spookt.FleePercent = 25; 33 Spookt.Idle = Images.Enemies.Ghost_Idle; 34 35 Spookt.BaseWaitTimeInSeconds = 3; 36 37 Spookt.Attacks.Add(AttackList.SpookyAttack()); 38 39 return Spookt; 40 } 21 41 } -
2015/26/MikkoL/JRPG/JRPG/JRPG/Images.cs
r6281 r6304 20 20 { 21 21 public static Image Testman_Idle = JRPG.LoadImage("Enemies//Testman//Enemy_Testman"); 22 23 public static Image Ghost_Idle = JRPG.LoadImage("Enemies//Spookt/Spookt"); 24 22 25 } 23 26 -
2015/26/MikkoL/JRPG/JRPG/JRPG/JRPG.csproj.Debug.cachefile
r6296 r6304 24 24 Content\Water\Anim_Water02_0.xnb 25 25 Content\Water\Anim_Water03_0.xnb 26 Content\Enemies\Spookt\Spookt.xnb 26 27 Content\AsRifle.xnb 27 28 Content\Auto.xnb -
2015/26/MikkoL/JRPG/JRPG/JRPG/Overworld/MapData.cs
r6281 r6304 12 12 public static int StepsToAnEncounter { get; set; } 13 13 public static int EncounterProbability { get; set; } 14 15 public string CurrentMapIndex; 14 16 15 17 public List<EnemyGroup> EnemiesList() … … 40 42 public void LoadMapDataFromString(string MapIndex) 41 43 { 44 CurrentMapIndex = MapIndex; 45 42 46 if (MapIndex == "Test") 43 47 { … … 45 49 EncounterProbability = 25; 46 50 47 EnemyBase TestMan = EnemyList.Testman(); 48 EnemyBase TestMan2 = EnemyList.Testman(); 49 TestMan2.Name = "test 2"; 50 EnemyBase TestMan3 = EnemyList.Testman(); 51 TestMan3.Name = "test 3"; 52 EnemyBase TestMan4 = EnemyList.Testman(); 53 TestMan4.Name = "test 4"; 54 EnemyGroup Group = new EnemyGroup(100); 55 56 Group.AddEnemyToGroup(TestMan); 57 Group.AddEnemyToGroup(TestMan2); 58 Group.AddEnemyToGroup(TestMan3); 59 Group.AddEnemyToGroup(TestMan4); 60 Enemies.Add(Group); 51 InitializeEnemies(MapIndex); 61 52 62 53 _BackgroundImages.Add(Images.Backgrounds.Test); 63 54 } 64 55 } 56 57 public void InitializeEnemies(string MapIndex) 58 { 59 if (MapIndex == "Test") 60 { 61 Enemies.Clear(); 62 63 EnemyBase Ghost = EnemyList.Spookt(); 64 65 EnemyGroup Group = new EnemyGroup(100); 66 67 Group.Add(Ghost); 68 69 Enemies.Add(Group); 70 } 71 } 65 72 } -
2015/26/MikkoL/JRPG/JRPG/JRPG/obj/x86/Debug/JRPG.csproj.FileListAbsolute.txt
r6296 r6304 208 208 C:\Users\Mikko\Desktop\Peli2015\MikkoL\JRPG\JRPG\JRPG\obj\x86\Debug\JRPG.csprojResolveAssemblyReference.cache 209 209 C:\Users\Mikko\Desktop\Peli2015\MikkoL\JRPG\JRPG\JRPG\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt 210 C:\Users\Mikko\Desktop\Peli2015\MikkoL\JRPG\JRPG\JRPG\bin\x86\Debug\Content\Enemies\Spookt\Spookt.xnb -
2015/26/MikkoL/JRPG/JRPG/JRPG/obj/x86/Debug/cachefile-{D60BC67C-D86B-426A-A33D-CA5138E0FDF3}-targetpath.txt
r6296 r6304 24 24 Content\Water\Anim_Water02_0.xnb 25 25 Content\Water\Anim_Water03_0.xnb 26 Content\Enemies\Spookt\Spookt.xnb -
2015/26/MikkoL/JRPG/JRPG/JRPGContent/JRPGContent.contentproj
r6281 r6304 235 235 </Compile> 236 236 </ItemGroup> 237 <ItemGroup> 238 <Compile Include="Enemies\Spookt\Spookt.png"> 239 <Name>Spookt</Name> 240 <Importer>TextureImporter</Importer> 241 <Processor>TextureProcessor</Processor> 242 </Compile> 243 </ItemGroup> 237 244 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 238 245 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/26/MikkoL/JRPG/JRPG/JRPGContent/obj/x86/Debug/ContentPipeline.xml
r6296 r6304 226 226 <Output>C:\Users\Mikko\Desktop\Peli2015\MikkoL\JRPG\JRPG\JRPG\bin\x86\Debug\Content\Water\Anim_Water03_0.xnb</Output> 227 227 <Time>2015-06-24T18:22:08.6198799+03:00</Time> 228 </Item> 229 <Item> 230 <Source>Enemies\Spookt\Spookt.png</Source> 231 <Name>Enemies\Spookt\Spookt</Name> 232 <Importer>TextureImporter</Importer> 233 <Processor>TextureProcessor</Processor> 234 <Options>None</Options> 235 <Output>C:\Users\Mikko\Desktop\Peli2015\MikkoL\JRPG\JRPG\JRPG\bin\x86\Debug\Content\Enemies\Spookt\Spookt.xnb</Output> 236 <Time>2015-06-25T01:54:36.4186452+03:00</Time> 228 237 </Item> 229 238 <BuildSuccessful>true</BuildSuccessful>
Note: See TracChangeset
for help on using the changeset viewer.