update
- consumable items
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../providers/settings_provider.dart';
|
||||
import '../../game/enums.dart';
|
||||
|
||||
class BattleAnimationWidget extends StatefulWidget {
|
||||
@@ -77,6 +79,11 @@ class BattleAnimationWidgetState extends State<BattleAnimationWidget>
|
||||
await _translateController.reverse();
|
||||
} else {
|
||||
// Risky: Scale + Heavy Dash
|
||||
final attackScale = context.read<SettingsProvider>().attackAnimScale;
|
||||
_scaleAnimation = Tween<double>(begin: 1.0, end: attackScale).animate(
|
||||
CurvedAnimation(parent: _scaleController, curve: Curves.easeOut),
|
||||
);
|
||||
|
||||
_scaleController.duration = const Duration(milliseconds: 600);
|
||||
_translateController.duration = const Duration(milliseconds: 500);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../game/enums.dart';
|
||||
|
||||
import '../../game/config.dart';
|
||||
|
||||
class BattleControls extends StatelessWidget {
|
||||
@@ -7,6 +7,7 @@ class BattleControls extends StatelessWidget {
|
||||
final bool isDefendEnabled;
|
||||
final VoidCallback onAttackPressed;
|
||||
final VoidCallback onDefendPressed;
|
||||
final VoidCallback onItemPressed; // New
|
||||
|
||||
const BattleControls({
|
||||
super.key,
|
||||
@@ -14,22 +15,16 @@ class BattleControls extends StatelessWidget {
|
||||
required this.isDefendEnabled,
|
||||
required this.onAttackPressed,
|
||||
required this.onDefendPressed,
|
||||
required this.onItemPressed, // New
|
||||
});
|
||||
|
||||
Widget _buildFloatingActionButton({
|
||||
required String label,
|
||||
required Color color,
|
||||
required ActionType actionType,
|
||||
required String iconPath, // Changed from ActionType to String
|
||||
required bool isEnabled,
|
||||
required VoidCallback onPressed,
|
||||
}) {
|
||||
String iconPath;
|
||||
if (actionType == ActionType.attack) {
|
||||
iconPath = 'assets/data/icon/icon_weapon.png';
|
||||
} else {
|
||||
iconPath = 'assets/data/icon/icon_shield.png';
|
||||
}
|
||||
|
||||
return FloatingActionButton(
|
||||
heroTag: label,
|
||||
onPressed: isEnabled ? onPressed : null,
|
||||
@@ -53,7 +48,7 @@ class BattleControls extends StatelessWidget {
|
||||
_buildFloatingActionButton(
|
||||
label: "ATK",
|
||||
color: ThemeConfig.btnActionActive,
|
||||
actionType: ActionType.attack,
|
||||
iconPath: 'assets/data/icon/icon_weapon.png',
|
||||
isEnabled: isAttackEnabled,
|
||||
onPressed: onAttackPressed,
|
||||
),
|
||||
@@ -61,10 +56,20 @@ class BattleControls extends StatelessWidget {
|
||||
_buildFloatingActionButton(
|
||||
label: "DEF",
|
||||
color: ThemeConfig.btnDefendActive,
|
||||
actionType: ActionType.defend,
|
||||
iconPath: 'assets/data/icon/icon_shield.png',
|
||||
isEnabled: isDefendEnabled,
|
||||
onPressed: onDefendPressed,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildFloatingActionButton(
|
||||
label: "ITEM",
|
||||
color: Colors.indigoAccent, // Distinct color for Item
|
||||
iconPath:
|
||||
'assets/data/icon/icon_accessory.png', // Placeholder for Bag
|
||||
isEnabled:
|
||||
isAttackEnabled, // Enabled when it's player turn (same as attack)
|
||||
onPressed: onItemPressed,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,13 +68,16 @@ class CharacterStatusCard extends StatelessWidget {
|
||||
child: Wrap(
|
||||
spacing: 4.0,
|
||||
children: character.statusEffects.map((effect) {
|
||||
final isBuff = effect.type == StatusEffectType.attackUp;
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ThemeConfig.effectBg,
|
||||
color: isBuff
|
||||
? ThemeConfig.effectBuffBg
|
||||
: ThemeConfig.effectDebuffBg,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
|
||||
@@ -79,7 +79,7 @@ class RiskSelectionDialog extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
risk.name,
|
||||
risk.name.toUpperCase(),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(infoText, style: TextStyle(fontSize: 12, color: infoColor)),
|
||||
|
||||
Reference in New Issue
Block a user